Files
rust/tests/ui/error-codes/E0207.stderr
T
janwi_mac d02b4c8e77 Improve suggestions for unconstrained parameters in impl blocks
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.
2026-05-09 17:50:35 +12:00

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`.