-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Unconstrained parameter fix #148788
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
base: main
Are you sure you want to change the base?
Unconstrained parameter fix #148788
Changes from all commits
c18b48e
73b49d7
fb612ef
1230bc7
3bf7583
c8905fa
3b05974
de845c2
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,6 +3,14 @@ error[E0207]: the type parameter `Q` is not constrained by the impl trait, self | |
| | | ||
| LL | unsafe impl<Q: Trait> Send for Inner {} | ||
| | ^ unconstrained type parameter | ||
| | | ||
| help: either remove the unused type parameter `Q`, or make use of it | ||
| | | ||
| LL - unsafe impl<Q: Trait> Send for Inner {} | ||
| LL + unsafe impl Send for Inner {} | ||
| | | ||
| LL | unsafe impl<Q: Trait> Send for Inner<Q> {} | ||
|
Member
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. We should only suggest this if it could be correct (maybe by checking if the self type has generic parameters), or we should be very clear that it's just illustrative:
Author
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. Well there would another error if the struct Foo<N> {x: N}
impl<N> Foo {}which obviously gives the error, that the generic parameter N should be provided for the implementation of Foo: error[E0107]: missing generics for struct `Foo`
--> src/lib.rs:3:9
|
3 | impl<N> Foo {}
| ^^^ expected 1 generic argument
|
note: struct defined here, with 1 generic parameter: `N`
--> src/lib.rs:1:8
|
1 | struct Foo<N> {x: N}
| ^^^ -
help: add missing generic argument
|
3 | impl<N> Foo<N> {}
| +++
For more information about this error, try `rustc --explain E0107`.Therefore I would even suggest never suggesting to add the generic argument in general or did I miss some edgecase? |
||
| | +++ | ||
|
|
||
| error: aborting due to 1 previous error | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,11 @@ error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, | |
| | | ||
| LL | impl<'a> Foo<fn(&())> { | ||
| | ^^ unconstrained lifetime parameter | ||
| | | ||
| help: make use of the lifetime parameter `'a` in the `self` type | ||
| | | ||
| LL | impl<'a> Foo<fn(&()), 'a> { | ||
|
Member
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. Similarly to above, we should make sure this is correct or clearly indicate that it is purely illustrative. |
||
| | ++++ | ||
|
|
||
| error[E0308]: mismatched types | ||
| --> $DIR/hr-do-not-blame-outlives-static-ice.rs:14:11 | ||
|
|
||
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 don't think we should use a multi-part suggestion for this, these should be multiple distinct suggestions