You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Compile error when providing explicit generic arguments where impl Trait appears in bound of generic type #78936
I expected this to compile, however I received this error instead:
error[E0632]: cannot provide explicit generic arguments when `impl Trait` is used in argument position
--> x.rs:9:15
|
9 | example::<usize>();
| ^^^^^ explicit generic argument not allowed
This error is unexpected, because impl Debug is not used in the argument position and is instead part of a trait bound on a named type parameter.
changed the title [-]Compile error when providing explicit generic arguments where impl Trait appears in bound of generic argument[/-][+]Compile error when providing explicit generic arguments where impl Trait appears in bound of generic type[/+]on Nov 11, 2020
The error is intentional, as it would not be clear if/where its value can be specified by the caller (same reasoning as for impl Trait in argument position). The message could be improved though.
Activity
[-]Compile error when providing explicit generic arguments where impl Trait appears in bound of generic argument[/-][+]Compile error when providing explicit generic arguments where impl Trait appears in bound of generic type[/+]jonas-schievink commentedon Nov 11, 2020
The error is intentional, as it would not be clear if/where its value can be specified by the caller (same reasoning as for
impl Traitin argument position). The message could be improved though.Dylan-DPC commentedon Jan 1, 2025
Closing this as this code now compiles on stable & nightly