-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add field_scoped_visibility_modifiers lint #12893
Add field_scoped_visibility_modifiers lint #12893
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @blyxyas (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
e12bae5
to
2ea4242
Compare
Hmmmm... I'm not really understanding the appeal of this lint, could you explain it a little bit more? |
The primary goal is to make unsafe code more audit-able, the lint makes it easier to verify that invariants for a struct are upheld. If you opt-in to it then you only have to do local analysis on a struct when auditing it. If a struct has a field with As an example, this is a pub(crate) modifier being used on an id field in tokio. Presumably you would have the invariant that an id should never be changed, but that must be verified by checking the entire tokio crate where this struct is used. A better way to access this would be to add a |
+1, I'd really like to have this lint available |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay, I've been kinda busy these few days. After some thinking, it seems like this lint could be useful in the strictest of codebases, and it doesn't represent much overhead to have a restriction lint.
LGTM, thanks! ❤️
No problem at all, thank you for reviewing 😊 |
☔ The latest upstream changes (presumably #12849) made this pull request unmergeable. Please resolve the merge conflicts. |
I've opened the Final Comment Period stream here, and we have some feedback:
|
b28bbde
to
3c5dcf3
Compare
☔ The latest upstream changes (presumably #12937) made this pull request unmergeable. Please resolve the merge conflicts. |
2ce2725
to
e2e57e6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okis, now that some time has passed and the FCP seems to be alright, we can now merge it! Could you squash these 3 commits into one?
e2e57e6
to
3405ce3
Compare
Sounds good, just squashed them. Thanks again for the review process! |
@bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
changelog: [
field_scoped_visibility_modifiers
]: Add a lint which checks for struct fields using Restricted (not inherited, not public) visibility modifiers.