about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/run-make/jobserver-error/Makefile1
-rw-r--r--tests/ui/generics/issue-79605.rs6
-rw-r--r--tests/ui/generics/issue-79605.stderr14
-rw-r--r--tests/ui/implied-bounds/issue-110161.rs26
-rw-r--r--tests/ui/implied-bounds/issue-110161.stderr12
5 files changed, 59 insertions, 0 deletions
diff --git a/tests/run-make/jobserver-error/Makefile b/tests/run-make/jobserver-error/Makefile
index 39946ae5edb..4a1699cc740 100644
--- a/tests/run-make/jobserver-error/Makefile
+++ b/tests/run-make/jobserver-error/Makefile
@@ -1,6 +1,7 @@
 include ../tools.mk
 
 # only-linux
+# ignore-test: This test randomly fails, see https://github.com/rust-lang/rust/issues/110321
 
 # Test compiler behavior in case: `jobserver-auth` points to correct pipe which is not jobserver.
 
diff --git a/tests/ui/generics/issue-79605.rs b/tests/ui/generics/issue-79605.rs
new file mode 100644
index 00000000000..6f4c31e57a3
--- /dev/null
+++ b/tests/ui/generics/issue-79605.rs
@@ -0,0 +1,6 @@
+struct X<'a, T>(&'a T);
+
+impl X<'_, _> {}
+//~^ ERROR the placeholder `_` is not allowed within types on item signatures for implementations
+
+fn main() {}
diff --git a/tests/ui/generics/issue-79605.stderr b/tests/ui/generics/issue-79605.stderr
new file mode 100644
index 00000000000..c5584962dc9
--- /dev/null
+++ b/tests/ui/generics/issue-79605.stderr
@@ -0,0 +1,14 @@
+error[E0121]: the placeholder `_` is not allowed within types on item signatures for implementations
+  --> $DIR/issue-79605.rs:3:12
+   |
+LL | impl X<'_, _> {}
+   |            ^ not allowed in type signatures
+   |
+help: use type parameters instead
+   |
+LL | impl<T> X<'_, T> {}
+   |     +++       ~
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0121`.
diff --git a/tests/ui/implied-bounds/issue-110161.rs b/tests/ui/implied-bounds/issue-110161.rs
new file mode 100644
index 00000000000..e52c8356b52
--- /dev/null
+++ b/tests/ui/implied-bounds/issue-110161.rs
@@ -0,0 +1,26 @@
+// ICE regression relating to unconstrained lifetimes in implied
+// bounds. See #110161.
+
+// compile-flags: --crate-type=lib
+
+trait LtTrait {
+    type Ty;
+}
+
+// erroneous `Ty` impl
+impl LtTrait for () {
+//~^ ERROR not all trait items implemented, missing: `Ty` [E0046]
+}
+
+// `'lt` is not constrained by the erroneous `Ty`
+impl<'lt, T> LtTrait for Box<T>
+where
+    T: LtTrait<Ty = &'lt ()>,
+{
+    type Ty = &'lt ();
+}
+
+// unconstrained lifetime appears in implied bounds
+fn test(_: <Box<()> as LtTrait>::Ty) {}
+
+fn test2<'x>(_: &'x <Box<()> as LtTrait>::Ty) {}
diff --git a/tests/ui/implied-bounds/issue-110161.stderr b/tests/ui/implied-bounds/issue-110161.stderr
new file mode 100644
index 00000000000..9e0188694ed
--- /dev/null
+++ b/tests/ui/implied-bounds/issue-110161.stderr
@@ -0,0 +1,12 @@
+error[E0046]: not all trait items implemented, missing: `Ty`
+  --> $DIR/issue-110161.rs:11:1
+   |
+LL |     type Ty;
+   |     ------- `Ty` from trait
+...
+LL | impl LtTrait for () {
+   | ^^^^^^^^^^^^^^^^^^^ missing `Ty` in implementation
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0046`.