Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Context Privacy 2 #738

Merged
merged 1 commit into from
Mar 15, 2024
Merged

Context Privacy 2 #738

merged 1 commit into from
Mar 15, 2024

Conversation

knoellle
Copy link
Contributor

@knoellle knoellle commented Mar 10, 2024

Introduced Changes

Context (heh): #535

Removes pub tags from all CreationContext and CycleContext struct members since they are unnecessary and prevent detection of unused fields.

Also adds a check to our source analyzer which makes pub fields in contexts a compilation error with the exception of MainOutput fields.
I had wanted to make this a warning, but it appears that warnings from proc macros are only emitted on nightly.
There exists a proc-macro-warning crate, but that only supports deprecation warnings via a hack.

An alternative approach I considered is be to have the context macro strip the pub tag. This would allow detecting unused fields but also allows inconsistency and at least in my editor screws with the syntax highlighting.

Fixes #

ToDo / Known Issues

Ideas for Next Iterations (Not This PR)

Find a way to emit warnings

How to Test

Making any context field pub should result in a an error.

@knoellle knoellle added the is:Cleanup Nothing new here, just tidying up. label Mar 10, 2024
@knoellle knoellle enabled auto-merge March 10, 2024 00:15
Copy link
Member

@schmidma schmidma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's discuss... (just removing the existing pubs i am definitely fine with)

crates/context_attribute/src/lib.rs Outdated Show resolved Hide resolved
@schmidma schmidma self-assigned this Mar 10, 2024
@knoellle knoellle added this pull request to the merge queue Mar 15, 2024
Merged via the queue into HULKs:main with commit 29ede7f Mar 15, 2024
20 checks passed
@knoellle knoellle deleted the context-privacy-2 branch March 15, 2024 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:Cleanup Nothing new here, just tidying up.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants