diff --git a/tests/ui/typeck/escaping_bound_vars.rs b/tests/ui/typeck/escaping_bound_vars.rs new file mode 100644 index 0000000000000..1fb063d2c2689 --- /dev/null +++ b/tests/ui/typeck/escaping_bound_vars.rs @@ -0,0 +1,16 @@ +// Test for issues/115517 which is fixed by pull/115486 +// This should not ice +trait Test {} + +trait Elide { + fn call(); +} + +pub fn test() +where + (): Test<{ 1 + (<() as Elide(&())>::call) }>, + //~^ ERROR cannot capture late-bound lifetime in constant +{ +} + +fn main() {} diff --git a/tests/ui/typeck/escaping_bound_vars.stderr b/tests/ui/typeck/escaping_bound_vars.stderr new file mode 100644 index 0000000000000..f7077e52a707f --- /dev/null +++ b/tests/ui/typeck/escaping_bound_vars.stderr @@ -0,0 +1,10 @@ +error: cannot capture late-bound lifetime in constant + --> $DIR/escaping_bound_vars.rs:11:35 + | +LL | (): Test<{ 1 + (<() as Elide(&())>::call) }>, + | -^ + | | + | lifetime defined here + +error: aborting due to previous error +