summaryrefslogtreecommitdiffstats
path: root/src/test/ui/regions/do-not-suggest-adding-bound-to-opaque-type.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/regions/do-not-suggest-adding-bound-to-opaque-type.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/ui/regions/do-not-suggest-adding-bound-to-opaque-type.rs b/src/test/ui/regions/do-not-suggest-adding-bound-to-opaque-type.rs
new file mode 100644
index 000000000..a1e801e39
--- /dev/null
+++ b/src/test/ui/regions/do-not-suggest-adding-bound-to-opaque-type.rs
@@ -0,0 +1,12 @@
+pub trait T {}
+
+struct S<'a>(&'a ());
+
+impl<'a> T for S<'a> {}
+
+fn foo() -> impl T {
+ let x = ();
+ S(&x) //~ ERROR `x` does not live long enough
+}
+
+fn main() {}