-
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
Change the criteria of interior_mutable_const
#6046
Change the criteria of interior_mutable_const
#6046
Conversation
r? @phansch (rust_highfive has picked a reviewer for you, use r? to override) |
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.
LGTM overall. Linting trait impls over trait definitions is definitely the better approach here. The tests are a little mind boggling with the spaghetti traits, but they also looked good to me.
r? @flip1995 |
* stop linting associated types and generic type parameters * start linting ones in trait impls whose corresponding definitions in the traits are generic * remove the `is_copy` check as presumably the only purpose of it is to allow generics with `Copy` bounds as `Freeze` is internal and generics are no longer linted * remove the term 'copy' from the tests as being `Copy` no longer have meaning
2e158f4
to
74c2a71
Compare
* rewrite the test for `declare_interior_mutable_const from scratch` * fix a minor false positive where `Cell<"const T>` gets linted twice
74c2a71
to
2fc9064
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.
Thanks for the test restructure. This looks really good to me now and is way easier to understand.
Can you add the example from #5050 to the tests? I don't see why it should still get linted, but Self
in a generics position made problems in the past for other lints. So basically the same as the part of the test with the SelfType
trait, just with Option
wrapped around Self
. Also add a comment referring to the issue #5050, please.
Of cource. Do you prefer |
Perfect, thanks! @bors r+ |
📌 Commit d5af360 has been approved by |
…p1995 Change the criteria of `interior_mutable_const` This implements my suggestion [here](#5050 (comment)), and so hopefully fixes #5050. * stop linting associated types and generic type parameters * start linting ones in trait impls whose corresponding definitions in the traits are generic * remove the `is_copy` check as presumably the only purpose of it is to allow generics with `Copy` bounds as `Freeze` is internal and generics are no longer linted * remove the term 'copy' from the tests as being `Copy` no longer have meaning --- changelog: Change the criteria of `declare_interior_mutable_const` and `borrow_interior_mutable_const` to narrow the lints to only lint things that defenitly is a interior mutable type, not potentially.
💔 Test failed - checks-action_test |
@bors retry A failure in the "Set up job" step seems really weird. I hope we don't have to debug this... |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
This implements my suggestion here, and so hopefully fixes #5050.
whose corresponding definitions in the traits are generic
is_copy
checkas presumably the only purpose of it is to allow
generics with
Copy
bounds asFreeze
is internaland generics are no longer linted
as being
Copy
no longer have meaningchangelog: Change the criteria of
declare_interior_mutable_const
andborrow_interior_mutable_const
to narrow the lints to only lint things that defenitly is a interior mutable type, not potentially.