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)
This commit is contained in:
commit
ff8cdc9e14
10 changed files with 287 additions and 99 deletions
|
@ -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() {}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue