about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2019-05-24 14:02:05 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2019-05-24 15:15:55 +0200
commitc235ba4d0b7b8ff74b0fe020df6625ec9ce74ceb (patch)
tree2a060811a0fa7b7b8e7540b70ea5ea444f9a309f
parent8e4132a55c625de8ba431a4e9fe72339c777e96a (diff)
downloadrust-c235ba4d0b7b8ff74b0fe020df6625ec9ce74ceb.tar.gz
rust-c235ba4d0b7b8ff74b0fe020df6625ec9ce74ceb.zip
Regression test for issue #60654.
-rw-r--r--src/test/ui/rfc1598-generic-associated-types/gat-dont-ice-on-absent-feature.rs14
-rw-r--r--src/test/ui/rfc1598-generic-associated-types/gat-dont-ice-on-absent-feature.stderr12
2 files changed, 26 insertions, 0 deletions
diff --git a/src/test/ui/rfc1598-generic-associated-types/gat-dont-ice-on-absent-feature.rs b/src/test/ui/rfc1598-generic-associated-types/gat-dont-ice-on-absent-feature.rs
new file mode 100644
index 00000000000..84fbb47301f
--- /dev/null
+++ b/src/test/ui/rfc1598-generic-associated-types/gat-dont-ice-on-absent-feature.rs
@@ -0,0 +1,14 @@
+// rust-lang/rust#60654: Do not ICE on an attempt to use GATs that is
+// missing the feature gate.
+
+struct Foo;
+
+impl Iterator for Foo {
+    type Item<'b> = &'b Foo; //~ ERROR generic associated types are unstable [E0658]
+
+    fn next(&mut self) -> Option<Self::Item> {
+        None
+    }
+}
+
+fn main() { }
diff --git a/src/test/ui/rfc1598-generic-associated-types/gat-dont-ice-on-absent-feature.stderr b/src/test/ui/rfc1598-generic-associated-types/gat-dont-ice-on-absent-feature.stderr
new file mode 100644
index 00000000000..27b1d73d043
--- /dev/null
+++ b/src/test/ui/rfc1598-generic-associated-types/gat-dont-ice-on-absent-feature.stderr
@@ -0,0 +1,12 @@
+error[E0658]: generic associated types are unstable
+  --> $DIR/gat-dont-ice-on-absent-feature.rs:7:5
+   |
+LL |     type Item<'b> = &'b Foo;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: for more information, see https://github.com/rust-lang/rust/issues/44265
+   = help: add #![feature(generic_associated_types)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.