]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/issue-98693.rs
Auto merge of #103600 - compiler-errors:early-binder-nits, r=spastorino
[rust.git] / src / test / ui / nll / issue-98693.rs
1 // Regression test for #98693.
2 //
3 // The closure encounters an obligation that `T` must outlive `!U1`,
4 // a placeholder from universe U1. We were ignoring this placeholder
5 // when promoting the constraint to the enclosing function, and
6 // thus incorrectly judging the closure to be safe.
7
8 fn assert_static<T>()
9 where
10     for<'a> T: 'a,
11 {
12 }
13
14 fn test<T>() {
15     || {
16         assert_static::<T>();
17         //~^ ERROR the parameter type `T` may not live long enough
18     };
19 }
20
21 fn main() {}