2024-10-04 09:10:28 -05:00
error[E0782]: expected a type, found a trait
2024-01-23 12:24:40 -06:00
--> $DIR/avoid-ice-on-warning-2.rs:4:13
|
LL | fn id<F>(f: Copy) -> usize {
2024-10-04 09:10:28 -05:00
| ^^^^
2024-01-23 12:24:40 -06:00
|
2024-10-04 09:10:28 -05: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 06:17:55 -06:00
|
2024-10-04 09:10:28 -05: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 06:17:55 -06:00
|
LL | fn id<F>(f: impl Copy) -> usize {
| ++++
2024-10-04 09:10:28 -05:00
error: aborting due to 1 previous error
2024-01-23 12:24:40 -06:00
2024-10-04 09:10:28 -05:00
For more information about this error, try `rustc --explain E0782`.