mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 22:18:23 +03:00
d02b4c8e77
When an unconstrained type or lifetime parameter is detected in an `impl`, provide more specific help based on its usage: - If the parameter is entirely unused, suggest removing it. - If it is used in the `impl` body but not the `Self` type, suggest including it in the `Self` type and the struct definition. This also adds a comprehensive UI test for these cases.
17 lines
464 B
Plaintext
17 lines
464 B
Plaintext
error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
|
|
--> $DIR/E0207.rs:3:6
|
|
|
|
|
LL | impl<T: Default> Foo {
|
|
| ^ unconstrained type parameter
|
|
|
|
|
help: use the type parameter `T` in the `Foo` type and use it in the type definition
|
|
|
|
|
LL ~ struct Foo<T>;
|
|
LL |
|
|
LL ~ impl<T: Default> Foo<T> {
|
|
|
|
|
|
|
error: aborting due to 1 previous error
|
|
|
|
For more information about this error, try `rustc --explain E0207`.
|