diff --git a/tests/ui/traits/late-bound-type-method-probe.rs b/tests/ui/traits/late-bound-type-method-probe.rs new file mode 100644 index 0000000000000..ed6b3d866d7a2 --- /dev/null +++ b/tests/ui/traits/late-bound-type-method-probe.rs @@ -0,0 +1,19 @@ +// A method probe involving a late-bound type parameter should report normal +// diagnostics instead of ICEing while structurally normalizing obligations. + +#![feature(non_lifetime_binders)] +#![allow(incomplete_features)] + +pub trait T { + fn t(&self, _: F) {} + //~^ ERROR cannot find type `F` in this scope +} + +pub fn crash(v: &V) +where + for F: T + 'static, +{ + v.t(|| {}); +} + +fn main() {} diff --git a/tests/ui/traits/late-bound-type-method-probe.stderr b/tests/ui/traits/late-bound-type-method-probe.stderr new file mode 100644 index 0000000000000..0ddeb301d5e03 --- /dev/null +++ b/tests/ui/traits/late-bound-type-method-probe.stderr @@ -0,0 +1,17 @@ +error[E0425]: cannot find type `F` in this scope + --> $DIR/late-bound-type-method-probe.rs:8:26 + | +LL | fn t(&self, _: F) {} + | ^ + | + --> $SRC_DIR/core/src/ops/function.rs:LL:COL + | + = note: similarly named trait `Fn` defined here +help: a trait with a similar name exists + | +LL | fn t(&self, _: Fn) {} + | + + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0425`.