2022-05-21 15:14:11 -04:00
|
|
|
// ignore-compare-mode-nll
|
|
|
|
// revisions: base nll
|
|
|
|
// [nll]compile-flags: -Zborrowck=mir
|
|
|
|
|
2022-01-31 19:11:23 -08:00
|
|
|
trait Foo: 'static { }
|
2020-08-15 12:29:23 +01:00
|
|
|
|
2022-01-31 19:11:23 -08:00
|
|
|
trait Bar<T>: Foo { }
|
2020-08-15 12:29:23 +01:00
|
|
|
|
2022-01-31 19:11:23 -08:00
|
|
|
fn test1<T: ?Sized + Bar<S>, S>() { }
|
2020-08-15 12:29:23 +01:00
|
|
|
|
2022-01-31 19:11:23 -08: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-05-21 15:14:11 -04:00
|
|
|
//[base]~^ ERROR the type `(dyn Bar<&'a u32> + 'static)` does not fulfill the required lifetime
|
|
|
|
//[nll]~^^ ERROR lifetime may not live long enough
|
2020-08-15 12:29:23 +01:00
|
|
|
}
|
|
|
|
|
2022-01-31 19:11:23 -08:00
|
|
|
fn main() { }
|