]> git.lizzy.rs Git - rust.git/blob - tests/ui/traits/object/supertrait-lifetime-bound.rs
Rollup merge of #106715 - BoxyUwU:new_solver_triagebot, r=lcnr
[rust.git] / tests / ui / traits / object / supertrait-lifetime-bound.rs
1 trait Foo: 'static { }
2
3 trait Bar<T>: Foo { }
4
5 fn test1<T: ?Sized + Bar<S>, S>() { }
6
7 fn test2<'a>() {
8     // Here: the type `dyn Bar<&'a u32>` references `'a`,
9     // and so it does not outlive `'static`.
10     test1::<dyn Bar<&'a u32>, _>();
11     //~^ ERROR lifetime may not live long enough
12 }
13
14 fn main() { }