summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/object/supertrait-lifetime-bound.rs
blob: f929a9bb66011d7ae20a3a00ffd579266049485c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
trait Foo: 'static { }

trait Bar<T>: Foo { }

fn test1<T: ?Sized + Bar<S>, S>() { }

fn test2<'a>() {
    // Here: the type `dyn Bar<&'a u32>` references `'a`,
    // and so it does not outlive `'static`.
    test1::<dyn Bar<&'a u32>, _>();
    //~^ ERROR lifetime may not live long enough
}

fn main() { }