about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-06-25 22:34:31 +0200
committerGitHub <noreply@github.com>2023-06-25 22:34:31 +0200
commitdfd6d708db968e93a67da4bb78acfb17216a627d (patch)
treeb673422d61e9cc8ac6f6af9a39fe8d9ded1de2e3 /tests
parent32995d87e62f93074686a056e41d11bb1a29aa73 (diff)
parentabe52cdcc79d654554789b35c85fbac4a79d3d42 (diff)
downloadrust-dfd6d708db968e93a67da4bb78acfb17216a627d.tar.gz
rust-dfd6d708db968e93a67da4bb78acfb17216a627d.zip
Rollup merge of #113030 - JohnTitor:issue-109071, r=TaKO8Ki
Add a regression test for #109071

Closes #109071
r? `@compiler-errors`
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/associated-inherent-types/issue-109071.no_gate.stderr35
-rw-r--r--tests/ui/associated-inherent-types/issue-109071.rs18
-rw-r--r--tests/ui/associated-inherent-types/issue-109071.with_gate.stderr26
3 files changed, 79 insertions, 0 deletions
diff --git a/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr b/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr
new file mode 100644
index 00000000000..8b6a8206569
--- /dev/null
+++ b/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr
@@ -0,0 +1,35 @@
+error[E0637]: `&` without an explicit lifetime name cannot be used here
+  --> $DIR/issue-109071.rs:8:17
+   |
+LL |     type Item = &[T];
+   |                 ^ explicit lifetime name needed here
+
+error[E0107]: missing generics for struct `Windows`
+  --> $DIR/issue-109071.rs:7:9
+   |
+LL | impl<T> Windows {
+   |         ^^^^^^^ expected 1 generic argument
+   |
+note: struct defined here, with 1 generic parameter: `T`
+  --> $DIR/issue-109071.rs:5:8
+   |
+LL | struct Windows<T> {}
+   |        ^^^^^^^ -
+help: add missing generic argument
+   |
+LL | impl<T> Windows<T> {
+   |                +++
+
+error[E0658]: inherent associated types are unstable
+  --> $DIR/issue-109071.rs:8:5
+   |
+LL |     type Item = &[T];
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
+   = help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0107, E0637, E0658.
+For more information about an error, try `rustc --explain E0107`.
diff --git a/tests/ui/associated-inherent-types/issue-109071.rs b/tests/ui/associated-inherent-types/issue-109071.rs
new file mode 100644
index 00000000000..73b969d5940
--- /dev/null
+++ b/tests/ui/associated-inherent-types/issue-109071.rs
@@ -0,0 +1,18 @@
+// revisions: with_gate no_gate
+#![cfg_attr(with_gate, feature(inherent_associated_types))]
+#![cfg_attr(with_gate, allow(incomplete_features))]
+
+struct Windows<T> {}
+
+impl<T> Windows { //~ ERROR: missing generics for struct `Windows`
+    type Item = &[T]; //~ ERROR: `&` without an explicit lifetime name cannot be used here
+    //[no_gate]~^ ERROR: inherent associated types are unstable
+
+    fn next() -> Option<Self::Item> {}
+}
+
+impl<T> Windows<T> {
+    fn T() -> Option<Self::Item> {}
+}
+
+fn main() {}
diff --git a/tests/ui/associated-inherent-types/issue-109071.with_gate.stderr b/tests/ui/associated-inherent-types/issue-109071.with_gate.stderr
new file mode 100644
index 00000000000..a91bb7a5162
--- /dev/null
+++ b/tests/ui/associated-inherent-types/issue-109071.with_gate.stderr
@@ -0,0 +1,26 @@
+error[E0637]: `&` without an explicit lifetime name cannot be used here
+  --> $DIR/issue-109071.rs:8:17
+   |
+LL |     type Item = &[T];
+   |                 ^ explicit lifetime name needed here
+
+error[E0107]: missing generics for struct `Windows`
+  --> $DIR/issue-109071.rs:7:9
+   |
+LL | impl<T> Windows {
+   |         ^^^^^^^ expected 1 generic argument
+   |
+note: struct defined here, with 1 generic parameter: `T`
+  --> $DIR/issue-109071.rs:5:8
+   |
+LL | struct Windows<T> {}
+   |        ^^^^^^^ -
+help: add missing generic argument
+   |
+LL | impl<T> Windows<T> {
+   |                +++
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0107, E0637.
+For more information about an error, try `rustc --explain E0107`.