about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2023-03-21 01:09:00 +0100
committerLeón Orell Valerian Liehr <me@fmease.dev>2023-03-21 23:53:58 +0100
commit293f21c876278df7943eea889dacd977155a2f62 (patch)
treef38e5c6d98ea8e2d6d96dfde3f6819aa5530ea59 /tests
parent44f5180584404d18058cbbf224c55255db4fdcbb (diff)
downloadrust-293f21c876278df7943eea889dacd977155a2f62.tar.gz
rust-293f21c876278df7943eea889dacd977155a2f62.zip
iat selection: erase regions in self type
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/associated-inherent-types/issue-109299-1.rs12
-rw-r--r--tests/ui/associated-inherent-types/issue-109299-1.stderr15
-rw-r--r--tests/ui/associated-inherent-types/issue-109299.rs12
-rw-r--r--tests/ui/associated-inherent-types/issue-109299.stderr11
4 files changed, 50 insertions, 0 deletions
diff --git a/tests/ui/associated-inherent-types/issue-109299-1.rs b/tests/ui/associated-inherent-types/issue-109299-1.rs
new file mode 100644
index 00000000000..6f95273116b
--- /dev/null
+++ b/tests/ui/associated-inherent-types/issue-109299-1.rs
@@ -0,0 +1,12 @@
+#![feature(inherent_associated_types, non_lifetime_binders, type_alias_impl_trait)]
+#![allow(incomplete_features)]
+
+struct Lexer<T>(T);
+
+impl Lexer<i32> {
+    type Cursor = ();
+}
+
+type X = impl for<T> Fn() -> Lexer<T>::Cursor; //~ ERROR associated type `Cursor` not found for `Lexer<T>` in the current scope
+
+fn main() {}
diff --git a/tests/ui/associated-inherent-types/issue-109299-1.stderr b/tests/ui/associated-inherent-types/issue-109299-1.stderr
new file mode 100644
index 00000000000..dc59b56ee20
--- /dev/null
+++ b/tests/ui/associated-inherent-types/issue-109299-1.stderr
@@ -0,0 +1,15 @@
+error[E0220]: associated type `Cursor` not found for `Lexer<T>` in the current scope
+  --> $DIR/issue-109299-1.rs:10:40
+   |
+LL | struct Lexer<T>(T);
+   | --------------- associated item `Cursor` not found for this struct
+...
+LL | type X = impl for<T> Fn() -> Lexer<T>::Cursor;
+   |                                        ^^^^^^ associated item not found in `Lexer<T>`
+   |
+   = note: the associated type was found for
+           - `Lexer<i32>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0220`.
diff --git a/tests/ui/associated-inherent-types/issue-109299.rs b/tests/ui/associated-inherent-types/issue-109299.rs
new file mode 100644
index 00000000000..84e4f9e7252
--- /dev/null
+++ b/tests/ui/associated-inherent-types/issue-109299.rs
@@ -0,0 +1,12 @@
+#![feature(inherent_associated_types)]
+#![allow(incomplete_features)]
+
+struct Lexer<'d>(&'d ());
+
+impl Lexer<'d> { //~ ERROR use of undeclared lifetime name `'d`
+    type Cursor = ();
+}
+
+fn test(_: Lexer::Cursor) {}
+
+fn main() {}
diff --git a/tests/ui/associated-inherent-types/issue-109299.stderr b/tests/ui/associated-inherent-types/issue-109299.stderr
new file mode 100644
index 00000000000..63f50732d3c
--- /dev/null
+++ b/tests/ui/associated-inherent-types/issue-109299.stderr
@@ -0,0 +1,11 @@
+error[E0261]: use of undeclared lifetime name `'d`
+  --> $DIR/issue-109299.rs:6:12
+   |
+LL | impl Lexer<'d> {
+   |     -      ^^ undeclared lifetime
+   |     |
+   |     help: consider introducing lifetime `'d` here: `<'d>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0261`.