diff options
Diffstat (limited to 'src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs')
-rw-r--r-- | src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs new file mode 100644 index 000000000..85a332e24 --- /dev/null +++ b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs @@ -0,0 +1,22 @@ +#![feature(rustc_attrs)] +#![allow(dead_code)] + +trait Trait<'a, T> { + type Out; +} + +impl<'a, T> Trait<'a, T> for usize { + type Out = &'a fn(T); //~ ERROR `T` may not live long enough +} + +struct Foo<'a,T> { + f: &'a fn(T), +} + +trait Baz<T> { } + +impl<'a, T> Trait<'a, T> for u32 { + type Out = &'a dyn Baz<T>; //~ ERROR `T` may not live long enough +} + +fn main() { } |