about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/generic-associated-types/issue-86483.rs15
-rw-r--r--src/test/ui/generic-associated-types/issue-86483.stderr36
2 files changed, 51 insertions, 0 deletions
diff --git a/src/test/ui/generic-associated-types/issue-86483.rs b/src/test/ui/generic-associated-types/issue-86483.rs
new file mode 100644
index 00000000000..9d03c9dab8d
--- /dev/null
+++ b/src/test/ui/generic-associated-types/issue-86483.rs
@@ -0,0 +1,15 @@
+// Regression test of #86483.
+
+#![feature(generic_associated_types)]
+#![allow(incomplete_features)]
+
+pub trait IceIce<T> //~ ERROR: the parameter type `T` may not live long enough
+where
+    for<'a> T: 'a,
+{
+    type Ice<'v>: IntoIterator<Item = &'v T>;
+    //~^ ERROR: the parameter type `T` may not live long enough
+    //~| ERROR: the parameter type `T` may not live long enough
+}
+
+fn main() {}
diff --git a/src/test/ui/generic-associated-types/issue-86483.stderr b/src/test/ui/generic-associated-types/issue-86483.stderr
new file mode 100644
index 00000000000..c8efc2ed882
--- /dev/null
+++ b/src/test/ui/generic-associated-types/issue-86483.stderr
@@ -0,0 +1,36 @@
+error[E0311]: the parameter type `T` may not live long enough
+  --> $DIR/issue-86483.rs:6:1
+   |
+LL |   pub trait IceIce<T>
+   |   ^                - help: consider adding an explicit lifetime bound...: `T: 'a`
+   |  _|
+   | |
+LL | | where
+LL | |     for<'a> T: 'a,
+LL | | {
+...  |
+LL | |
+LL | | }
+   | |_^ ...so that the type `T` will meet its required lifetime bounds
+
+error[E0311]: the parameter type `T` may not live long enough
+  --> $DIR/issue-86483.rs:10:5
+   |
+LL | pub trait IceIce<T>
+   |                  - help: consider adding an explicit lifetime bound...: `T: 'a`
+...
+LL |     type Ice<'v>: IntoIterator<Item = &'v T>;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+
+error[E0309]: the parameter type `T` may not live long enough
+  --> $DIR/issue-86483.rs:10:32
+   |
+LL | pub trait IceIce<T>
+   |                  - help: consider adding an explicit lifetime bound...: `T: 'v`
+...
+LL |     type Ice<'v>: IntoIterator<Item = &'v T>;
+   |                                ^^^^^^^^^^^^ ...so that the reference type `&'v T` does not outlive the data it points at
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0309`.