-
-
Notifications
You must be signed in to change notification settings - Fork 78
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 lint trait_associated_const_added
#875
Conversation
Just to make sure, is this lint looking for "the const's default has disappeared" or "there's a new const that didn't exist before, and doesn't have a default"? Your query is very close either way, and I'll be happy to point you in the right direction. There are also a couple of filter operators that might be useful:
|
Lint is looking for "there's a new const that didn't exist before, and doesn't have a default". How can I check the addition of an assoc const? |
Try framing the query like this:
For the second part: "X does not exist" is a I think you already have the first part just about working in your PR. So minimal changes needed — you're super close. |
Lmk if you'd like more in-depth suggestions than I gave in my last post! No pressure to move this forward, it's totally fine if you had other things to do etc. I just want to make sure you aren't blocked because I did a bad job of explaining stuff :) Feel free to ping me with more questions anytime! |
Just didn't have time these last days. Simply switch the query parts made the tests pass with logical results. |
Nice! The new query looks good. A few remaining things to look into:
|
I don't know where to look for the |
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.
The cargo SemVer reference, and the API evolution RFC 1105, are the two authoritative documents on SemVer in Rust.
I suggested a link to the "trait added non-defaulted item" section, which encompasses this lint.
If a trait is being annoying in tests and you want to make it not object-safe when it doesn't have a |
I would love to be able to bless tests |
I'll remove the comments in |
@@ -5,30 +5,44 @@ mod sealed { | |||
// trigger | |||
pub trait WillGainConstWithoutDefault { | |||
const BAR: bool; | |||
|
|||
fn make_me_object_safe() -> Self; |
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.
These are actually making the trait stop being object-safe, just like having a const
does.
Perhaps a better name:
fn make_me_object_safe() -> Self; | |
fn make_me_non_object_safe() -> Self; |
We have an open issue for switching to When I originally started |
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.
A couple of minor typo fixes, plus some edge cases with the lint I just noticed. Sorry I missed these earlier!
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.
Awesome! 🚀
Lint for "non-sealed trait added associated constant without default value"
See #870
This is my first
semver-checks
lint. I'm unsure how to proceed to check how a default value has disappeared for a given associated constant.I think I need to check if the default value of the assoc const is still
null
for thecurrent
crate. Looking at other lints, I should be able to do that withfold
andfilter
?Could someone provide a little guidance, so I can better understand how diff queries works?
Thanks