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
Respect MSRV (MAYBE_BOUND_IN_WHERE) #12388
base: master
Are you sure you want to change the base?
Conversation
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.
+1 for having this be part of the trait_bounds
pass, fits nicely with the other lints, and also nice seeing the cannot_combine_maybe_bound
function get some use
{ | ||
} | ||
} | ||
|
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.
Can we have a test case for something like
fn f<'a, a: Sized>() where 'a: 'static {}
where the type parameter is named after a lifetime? I think this currently happens to work (ie not get linted) because the name of lifetimes include the quote, which differentiates them, but it would be good to have this as a guarantee in the testsuite.
@@ -99,10 +126,11 @@ impl TraitBounds { | |||
} | |||
} | |||
|
|||
impl_lint_pass!(TraitBounds => [TYPE_REPETITION_IN_BOUNDS, TRAIT_DUPLICATION_IN_BOUNDS]); | |||
impl_lint_pass!(TraitBounds => [TYPE_REPETITION_IN_BOUNDS, TRAIT_DUPLICATION_IN_BOUNDS, MULTIPLE_BOUND_LOCATIONS]); | |||
|
|||
impl<'tcx> LateLintPass<'tcx> for TraitBounds { | |||
fn check_generics(&mut self, cx: &LateContext<'tcx>, gen: &'tcx Generics<'_>) { |
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.
Since we now not only lint on functions, but also impls and a bunch of other items, I wonder how this interacts with derive macros such as Debug
. Would be good to have a test, to make sure it doesn't lint here:
#[derive(Debug)]
struct S<T> where T: Sized { t: T }
Hmm, looking more closely into the lints covered by this pass... Doesn't the |
☔ The latest upstream changes (presumably #12077) made this pull request unmergeable. Please resolve the merge conflicts. |
Fix #12370.
changelog: [
multiple_bound_locations
]: respect MSRV for combining?Sized
bound