rust/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.new.stderr

20 lines
688 B
Plaintext

error[E0782]: expected a type, found a trait
--> $DIR/avoid-ice-on-warning-2.rs:4:13
|
LL | fn id<F>(f: Copy) -> usize {
| ^^^^
|
= note: `Copy` it is dyn-incompatible, so it can't be `dyn`
help: use a new generic type parameter, constrained by `Copy`
|
LL | fn id<F, T: Copy>(f: T) -> usize {
| +++++++++ ~
help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
|
LL | fn id<F>(f: impl Copy) -> usize {
| ++++
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0782`.