2024-10-04 16:10:28 +02:00
error[E0782]: expected a type, found a trait
2024-01-23 18:24:40 +00:00
--> $DIR/avoid-ice-on-warning-2.rs:4:13
|
LL | fn id<F>(f: Copy) -> usize {
2024-10-04 16:10:28 +02:00
| ^^^^
2024-01-23 18:24:40 +00:00
|
2024-10-04 16:10:28 +02:00
= note: `Copy` it is dyn-incompatible, so it can't be `dyn`
help: use a new generic type parameter, constrained by `Copy`
2024-02-09 12:17:55 +00:00
|
2024-10-04 16:10:28 +02:00
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
2024-02-09 12:17:55 +00:00
|
LL | fn id<F>(f: impl Copy) -> usize {
| ++++
2024-10-04 16:10:28 +02:00
error: aborting due to 1 previous error
2024-01-23 18:24:40 +00:00
2024-10-04 16:10:28 +02:00
For more information about this error, try `rustc --explain E0782`.