about summary refs log tree commit diff
path: root/tests/ui/parser
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-03-26 21:23:47 +0100
committerGitHub <noreply@github.com>2024-03-26 21:23:47 +0100
commitff8cdc9e14a4e0840fa60b5fdd2e7029a0c664bb (patch)
treeae7f63fca0a79cceb38f23df980062be8e3e1114 /tests/ui/parser
parent9162776c6640fddd909edf755d0b9489730c89c2 (diff)
parent3879acbec090b36454c0384cd8602047b806f47a (diff)
downloadrust-ff8cdc9e14a4e0840fa60b5fdd2e7029a0c664bb.tar.gz
rust-ff8cdc9e14a4e0840fa60b5fdd2e7029a0c664bb.zip
Rollup merge of #122120 - fmease:sugg-assoc-ty-bound-on-eq-bound, r=compiler-errors
Suggest associated type bounds on problematic associated equality bounds

Fixes #105056. TL;DR: Suggest `Trait<Ty: Bound>` on `Trait<Ty = Bound>` in Rust >=2021.

~~Blocked on #122055 (stabilization of `associated_type_bounds`), I'd say.~~ (merged)
Diffstat (limited to 'tests/ui/parser')
-rw-r--r--tests/ui/parser/recover/recover-assoc-lifetime-constraint.rs2
-rw-r--r--tests/ui/parser/recover/recover-assoc-lifetime-constraint.stderr17
2 files changed, 12 insertions, 7 deletions
diff --git a/tests/ui/parser/recover/recover-assoc-lifetime-constraint.rs b/tests/ui/parser/recover/recover-assoc-lifetime-constraint.rs
index 558fcdfe177..cb65f80b089 100644
--- a/tests/ui/parser/recover/recover-assoc-lifetime-constraint.rs
+++ b/tests/ui/parser/recover/recover-assoc-lifetime-constraint.rs
@@ -1,6 +1,6 @@
 #[cfg(FALSE)]
 fn syntax() {
-    bar::<Item = 'a>(); //~ ERROR associated lifetimes are not supported
+    bar::<Item = 'a>(); //~ ERROR lifetimes are not permitted in this context
 }
 
 fn main() {}
diff --git a/tests/ui/parser/recover/recover-assoc-lifetime-constraint.stderr b/tests/ui/parser/recover/recover-assoc-lifetime-constraint.stderr
index 39a6682fcae..606b737e723 100644
--- a/tests/ui/parser/recover/recover-assoc-lifetime-constraint.stderr
+++ b/tests/ui/parser/recover/recover-assoc-lifetime-constraint.stderr
@@ -1,12 +1,17 @@
-error: associated lifetimes are not supported
-  --> $DIR/recover-assoc-lifetime-constraint.rs:3:11
+error: lifetimes are not permitted in this context
+  --> $DIR/recover-assoc-lifetime-constraint.rs:3:18
    |
 LL |     bar::<Item = 'a>();
-   |           ^^^^^^^--
-   |                  |
-   |                  the lifetime is given here
+   |           -------^^
+   |           |      |
+   |           |      lifetime is not allowed here
+   |           this introduces an associated item binding
    |
-   = help: if you meant to specify a trait object, write `dyn Trait + 'lifetime`
+   = help: if you meant to specify a trait object, write `dyn /* Trait */ + 'a`
+help: you might have meant to write a bound here
+   |
+LL |     bar::<Item: 'a>();
+   |               ~
 
 error: aborting due to 1 previous error