2022-02-01 03:11:23 +00:00
|
|
|
trait Foo: 'static { }
|
2020-08-15 11:29:23 +00:00
|
|
|
|
2022-02-01 03:11:23 +00:00
|
|
|
trait Bar<T>: Foo { }
|
2020-08-15 11:29:23 +00:00
|
|
|
|
2022-02-01 03:11:23 +00:00
|
|
|
fn test1<T: ?Sized + Bar<S>, S>() { }
|
2020-08-15 11:29:23 +00:00
|
|
|
|
2022-02-01 03:11:23 +00:00
|
|
|
fn test2<'a>() {
|
|
|
|
// Here: the type `dyn Bar<&'a u32>` references `'a`,
|
|
|
|
// and so it does not outlive `'static`.
|
|
|
|
test1::<dyn Bar<&'a u32>, _>();
|
2022-04-01 17:13:25 +00:00
|
|
|
//~^ ERROR lifetime may not live long enough
|
2020-08-15 11:29:23 +00:00
|
|
|
}
|
|
|
|
|
2022-02-01 03:11:23 +00:00
|
|
|
fn main() { }
|