about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/higher-ranked/trait-bounds/issue-59311.stderr26
-rw-r--r--tests/ui/higher-ranked/trait-bounds/trivial-does-not-hold.rs11
-rw-r--r--tests/ui/higher-ranked/trait-bounds/trivial-does-not-hold.stderr10
3 files changed, 41 insertions, 6 deletions
diff --git a/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr b/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr
index f8bed86ccf5..a26c617dc93 100644
--- a/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr
@@ -1,19 +1,33 @@
 error: implementation of `Trait` is not general enough
   --> $DIR/issue-59311.rs:17:5
    |
-LL |     v.t(|| {});
-   |     ^^^^^^^^^^ implementation of `Trait` is not general enough
+LL | / pub fn crash<V>(v: &V)
+LL | | where
+LL | |     for<'a> &'a V: Trait + 'static,
+   | |____________________-----__________- due to a where-clause on `crash`...
+   |                      |
+   |                      doesn't satisfy where-clause
+LL |   {
+LL |       v.t(|| {});
+   |       ^^^^^^^^^^
    |
-   = note: `Trait` would have to be implemented for the type `&'a V`
+   = note: ...`Trait` would have to be implemented for the type `&'a V`
    = note: ...but `Trait` is actually implemented for the type `&'0 V`, for some specific lifetime `'0`
 
 error: implementation of `Trait` is not general enough
   --> $DIR/issue-59311.rs:17:5
    |
-LL |     v.t(|| {});
-   |     ^^^^^^^^^^ implementation of `Trait` is not general enough
+LL | / pub fn crash<V>(v: &V)
+LL | | where
+LL | |     for<'a> &'a V: Trait + 'static,
+   | |____________________-----__________- due to a where-clause on `crash`...
+   |                      |
+   |                      doesn't satisfy where-clause
+LL |   {
+LL |       v.t(|| {});
+   |       ^^^^^^^^^^
    |
-   = note: `Trait` would have to be implemented for the type `&'a V`
+   = note: ...`Trait` would have to be implemented for the type `&'a V`
    = note: ...but `Trait` is actually implemented for the type `&'0 V`, for some specific lifetime `'0`
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
diff --git a/tests/ui/higher-ranked/trait-bounds/trivial-does-not-hold.rs b/tests/ui/higher-ranked/trait-bounds/trivial-does-not-hold.rs
new file mode 100644
index 00000000000..fa76686cc8b
--- /dev/null
+++ b/tests/ui/higher-ranked/trait-bounds/trivial-does-not-hold.rs
@@ -0,0 +1,11 @@
+// Minimized test from #59311.
+
+pub fn crash()
+where
+    for<'a> &'a (): 'static,
+{
+    || {};
+    //~^ ERROR higher-ranked lifetime error
+}
+
+fn main() {}
diff --git a/tests/ui/higher-ranked/trait-bounds/trivial-does-not-hold.stderr b/tests/ui/higher-ranked/trait-bounds/trivial-does-not-hold.stderr
new file mode 100644
index 00000000000..9e0d7e4b7be
--- /dev/null
+++ b/tests/ui/higher-ranked/trait-bounds/trivial-does-not-hold.stderr
@@ -0,0 +1,10 @@
+error: higher-ranked lifetime error
+  --> $DIR/trivial-does-not-hold.rs:7:5
+   |
+LL |     || {};
+   |     ^^^^^
+   |
+   = note: could not prove `for<'a> &'a (): 'b`
+
+error: aborting due to 1 previous error
+