summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/object/supertrait-lifetime-bound.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/traits/object/supertrait-lifetime-bound.rs')
-rw-r--r--tests/ui/traits/object/supertrait-lifetime-bound.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/traits/object/supertrait-lifetime-bound.rs b/tests/ui/traits/object/supertrait-lifetime-bound.rs
new file mode 100644
index 000000000..f929a9bb6
--- /dev/null
+++ b/tests/ui/traits/object/supertrait-lifetime-bound.rs
@@ -0,0 +1,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() { }