-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Suggest how to fix with unconstrained type parameters #134270
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,28 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self | |
| | ||
LL | impl<T: Tr> S<T::Assoc> { | ||
| ^ unconstrained type parameter | ||
| | ||
help: either remove the type parameter T, or make use of it, for example | ||
| | ||
LL - impl<T: Tr> S<T::Assoc> { | ||
LL + impl S<T::Assoc> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This case is more subtle. We should not suggest to remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like avoidable, but only we can do is to compare symbols of generics parameters and, bounds of them and generics of the type. Is it acceptable, or do you know better ways? |
||
| | ||
LL | impl<T: Tr> S<T::Assoc, T> { | ||
| +++ | ||
|
||
error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates | ||
--> $DIR/issue-26262.rs:17:6 | ||
| | ||
LL | impl<'a,T: Trait2<'a>> Trait1<<T as Trait2<'a>>::Foo> for T { | ||
| ^^ unconstrained lifetime parameter | ||
| | ||
help: either remove the type parameter 'a, or make use of it, for example | ||
| | ||
LL - impl<'a,T: Trait2<'a>> Trait1<<T as Trait2<'a>>::Foo> for T { | ||
LL + impl<T: Trait2<'a>> Trait1<<T as Trait2<'a>>::Foo> for T { | ||
| | ||
LL | impl<'a,T: Trait2<'a>> Trait1<<T as Trait2<'a>>::Foo> for T<'a> { | ||
| ++++ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
|
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.
I'm not really convinced that suggesting to use
Q
in some path is the right solution.Inner
takes no generic params, so the suggestion is wrong.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.
To do this, we must know the
ty::Ty
forself_ty
(e.g.Inner
here). Is there any way to get it?