Files
rust/tests/ui/impl-trait/auto-trait-selection.next.stderr
albab-hasan 3df075cdaa point at the opaque when its hidden type cannot be inferred
the note for an uninferable hidden type now points at the opaque definition, unless the error already points inside it
2026-10-14 16:37:25 +06:00

20 lines
691 B
Plaintext

error[E0282]: type annotations needed
--> $DIR/auto-trait-selection.rs:16:16
|
LL | if false { is_trait(foo()) } else { Default::default() }
| ^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `is_trait`
|
note: cannot infer type of hidden type of opaque
--> $DIR/auto-trait-selection.rs:15:13
|
LL | fn foo() -> impl Sized {
| ^^^^^^^^^^
help: consider specifying the generic arguments
|
LL | if false { is_trait::<T, U>(foo()) } else { Default::default() }
| ++++++++
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0282`.