summaryrefslogtreecommitdiffstats
path: root/tests/ui/associated-inherent-types
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/associated-inherent-types')
-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 000000000..6f9527311
--- /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 000000000..dc59b56ee
--- /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 000000000..84e4f9e72
--- /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 000000000..63f50732d
--- /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`.