1
Fork 0

Rollup merge of #127878 - estebank:assoc-item-removal, r=fmease

Fix associated item removal suggestion

We were previously telling people to write what was already there, instead of removal (treating it as a `help`). We now properly suggest to remove the code that needs to be removed.

```
error[E0229]: associated item constraints are not allowed here
  --> $DIR/E0229.rs:13:25
   |
LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {}
   |                         ^^^^^^^ associated item constraint not allowed here
   |
help: consider removing this associated item binding
   |
LL - fn baz<I>(x: &<I as Foo<A = Bar>>::A) {}
LL + fn baz<I>(x: &<I as Foo>::A) {}
   |
```
This commit is contained in:
Matthias Krüger 2024-07-18 08:09:01 +02:00 committed by GitHub
commit a13d7dbecf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 101 additions and 64 deletions

View file

@ -0,0 +1,11 @@
error[E0432]: unresolved import `inner`
--> $DIR/ice-unresolved-import-100241.rs:9:13
|
LL | pub use inner::S;
| ^^^^^ maybe a missing crate `inner`?
|
= help: consider adding `extern crate inner` to use the `inner` crate
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0432`.

View file

@ -6,8 +6,9 @@ LL | type A: S<C<X = 0i32> = 34>;
|
help: consider removing this associated item binding
|
LL | type A: S<C<X = 0i32> = 34>;
| ~~~~~~~~~~
LL - type A: S<C<X = 0i32> = 34>;
LL + type A: S<C = 34>;
|
error[E0229]: associated item constraints are not allowed here
--> $DIR/invalid_associated_const.rs:4:17
@ -18,8 +19,9 @@ LL | type A: S<C<X = 0i32> = 34>;
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider removing this associated item binding
|
LL | type A: S<C<X = 0i32> = 34>;
| ~~~~~~~~~~
LL - type A: S<C<X = 0i32> = 34>;
LL + type A: S<C = 34>;
|
error: aborting due to 2 previous errors

View file

@ -6,8 +6,9 @@ LL | type A: S<C<X = 0i32> = 34>;
|
help: consider removing this associated item binding
|
LL | type A: S<C<X = 0i32> = 34>;
| ~~~~~~~~~~
LL - type A: S<C<X = 0i32> = 34>;
LL + type A: S<C = 34>;
|
error[E0229]: associated item constraints are not allowed here
--> $DIR/issue-102467.rs:7:17
@ -18,8 +19,9 @@ LL | type A: S<C<X = 0i32> = 34>;
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider removing this associated item binding
|
LL | type A: S<C<X = 0i32> = 34>;
| ~~~~~~~~~~
LL - type A: S<C<X = 0i32> = 34>;
LL + type A: S<C = 34>;
|
error: aborting due to 2 previous errors