Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2296,7 +2296,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let suggested_name =
find_best_match_for_name(&[field.name], pat_field.ident.name, None);
if let Some(suggested_name) = suggested_name {
err.span_suggestion(
err.span_suggestion_verbose(
pat_field.ident.span,
"a field with a similar name exists",
suggested_name,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1963,7 +1963,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
};
(span, msg, suggestion.candidate.to_ident_string())
};
err.span_suggestion(span, msg, sugg, Applicability::MaybeIncorrect);
err.span_suggestion_verbose(span, msg, sugg, Applicability::MaybeIncorrect);
true
}

Expand Down
24 changes: 21 additions & 3 deletions tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -570,19 +570,37 @@ error: cannot find attribute `warn_` in this scope
--> $DIR/diagnostic-derive.rs:590:3
|
LL | #[warn_(no_crate_example, code = E0123)]
| ^^^^^ help: a built-in attribute with a similar name exists: `warn`
| ^^^^^
|
help: a built-in attribute with a similar name exists
|
LL - #[warn_(no_crate_example, code = E0123)]
LL + #[warn(no_crate_example, code = E0123)]
|

error: cannot find attribute `lint` in this scope
--> $DIR/diagnostic-derive.rs:597:3
|
LL | #[lint(no_crate_example, code = E0123)]
| ^^^^ help: a built-in attribute with a similar name exists: `link`
| ^^^^
|
help: a built-in attribute with a similar name exists
|
LL - #[lint(no_crate_example, code = E0123)]
LL + #[link(no_crate_example, code = E0123)]
|

error: cannot find attribute `lint` in this scope
--> $DIR/diagnostic-derive.rs:604:3
|
LL | #[lint(no_crate_example, code = E0123)]
| ^^^^ help: a built-in attribute with a similar name exists: `link`
| ^^^^
|
help: a built-in attribute with a similar name exists
|
LL - #[lint(no_crate_example, code = E0123)]
LL + #[link(no_crate_example, code = E0123)]
|

error: cannot find attribute `multipart_suggestion` in this scope
--> $DIR/diagnostic-derive.rs:644:3
Expand Down
8 changes: 7 additions & 1 deletion tests/ui/argument-suggestions/issue-109831.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ LL | struct A;
| --------- similarly named unit struct `A` defined here
...
LL | f(A, A, B, C);
| ^ help: a unit struct with a similar name exists: `A`
| ^
|
help: a unit struct with a similar name exists
|
LL - f(A, A, B, C);
LL + f(A, A, B, A);
|

error[E0061]: this function takes 3 arguments but 4 arguments were supplied
--> $DIR/issue-109831.rs:7:5
Expand Down
22 changes: 14 additions & 8 deletions tests/ui/associated-item/issue-87638.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ LL | type Target;
| ------------ associated type `Target` defined here
...
LL | let _: <S as Trait>::Output;
| ^^^^^^
| |
| not found in `Trait`
| help: maybe you meant this associated type: `Target`
| ^^^^^^ not found in `Trait`
|
help: maybe you meant this associated type
|
LL - let _: <S as Trait>::Output;
LL + let _: <S as Trait>::Target;
|

error[E0576]: cannot find method or associated constant `BAR` in trait `Trait`
--> $DIR/issue-87638.rs:20:27
Expand All @@ -17,10 +20,13 @@ LL | const FOO: usize;
| ----------------- associated constant `FOO` defined here
...
LL | let _ = <S as Trait>::BAR;
| ^^^
| |
| not found in `Trait`
| help: maybe you meant this associated constant: `FOO`
| ^^^ not found in `Trait`
|
help: maybe you meant this associated constant
|
LL - let _ = <S as Trait>::BAR;
LL + let _ = <S as Trait>::FOO;
|

error: aborting due to 2 previous errors

Expand Down
11 changes: 7 additions & 4 deletions tests/ui/associated-types/issue-19883.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ LL | type Output;
| ------------ associated type `Output` defined here
...
LL | <Dst as From<Self>>::Dst
| ^^^
| |
| not found in `From`
| help: maybe you meant this associated type: `Output`
| ^^^ not found in `From`
|
help: maybe you meant this associated type
|
LL - <Dst as From<Self>>::Dst
LL + <Dst as From<Self>>::Output
|

error: aborting due to 1 previous error

Expand Down
11 changes: 7 additions & 4 deletions tests/ui/associated-types/issue-22037.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ error[E0576]: cannot find associated type `X` in trait `A`
LL | type Output;
| ------------ associated type `Output` defined here
LL | fn a(&self) -> <Self as A>::X;
| ^
| |
| not found in `A`
| help: maybe you meant this associated type: `Output`
| ^ not found in `A`
|
help: maybe you meant this associated type
|
LL - fn a(&self) -> <Self as A>::X;
LL + fn a(&self) -> <Self as A>::Output;
|

error: aborting due to 1 previous error

Expand Down
8 changes: 7 additions & 1 deletion tests/ui/attributes/align-on-fields-143987.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ error[E0425]: cannot find type `usize8` in this scope
--> $DIR/align-on-fields-143987.rs:17:8
|
LL | x: usize8,
| ^^^^^^ help: a builtin type with a similar name exists: `usize`
| ^^^^^^
|
help: a builtin type with a similar name exists
|
LL - x: usize8,
LL + x: usize,
|

error: `#[rustc_align]` attribute cannot be used on struct fields
--> $DIR/align-on-fields-143987.rs:10:5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@ error[E0433]: failed to resolve: use of undeclared type `E`
--> $DIR/non-ADT-struct-pattern-box-pattern-ice-121463.rs:6:17
|
LL | let mut a = E::StructVar { boxed: Box::new(5_i32) };
| ^
| |
| use of undeclared type `E`
| help: a trait with a similar name exists: `Eq`
| ^ use of undeclared type `E`
|
help: a trait with a similar name exists
|
LL | let mut a = Eq::StructVar { boxed: Box::new(5_i32) };
| +

error[E0433]: failed to resolve: use of undeclared type `E`
--> $DIR/non-ADT-struct-pattern-box-pattern-ice-121463.rs:9:9
|
LL | E::StructVar { box boxed } => { }
| ^
| |
| use of undeclared type `E`
| help: a trait with a similar name exists: `Eq`
| ^ use of undeclared type `E`
|
help: a trait with a similar name exists
|
LL | Eq::StructVar { box boxed } => { }
| +

error: aborting due to 2 previous errors

Expand Down
6 changes: 5 additions & 1 deletion tests/ui/closures/issue-90871.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ error[E0425]: cannot find type `n` in this scope
--> $DIR/issue-90871.rs:4:22
|
LL | type_ascribe!(2, n([u8; || 1]))
| ^ help: a trait with a similar name exists: `Fn`
| ^
|
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
|
= note: similarly named trait `Fn` defined here
help: a trait with a similar name exists
|
LL | type_ascribe!(2, Fn([u8; || 1]))
| +

error[E0308]: mismatched types
--> $DIR/issue-90871.rs:4:29
Expand Down
16 changes: 14 additions & 2 deletions tests/ui/compiletest-self-test/ui-testing-optout.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ error[E0425]: cannot find type `D` in this scope
| ----------- similarly named type alias `A` defined here
...
7 | type C = D;
| ^ help: a type alias with a similar name exists: `A`
| ^
|
help: a type alias with a similar name exists
|
7 - type C = D;
7 + type C = A;
|

error[E0425]: cannot find type `F` in this scope
--> $DIR/ui-testing-optout.rs:92:10
Expand All @@ -20,7 +26,13 @@ error[E0425]: cannot find type `F` in this scope
| ----------- similarly named type alias `A` defined here
...
92 | type E = F;
| ^ help: a type alias with a similar name exists: `A`
| ^
|
help: a type alias with a similar name exists
|
92 - type E = F;
92 + type E = A;
|

error: aborting due to 3 previous errors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ error[E0425]: cannot find value `x` in this scope
--> $DIR/error_in_ty.rs:6:31
|
LL | pub struct A<const z: [usize; x]> {}
| - ^ help: a const parameter with a similar name exists: `z`
| - ^
| |
| similarly named const parameter `z` defined here
|
help: a const parameter with a similar name exists
|
LL - pub struct A<const z: [usize; x]> {}
LL + pub struct A<const z: [usize; z]> {}
|

error: `[usize; x]` is forbidden as the type of a const generic parameter
--> $DIR/error_in_ty.rs:6:23
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ LL | pub type v11 = [[usize; v4]; v4];
| --------------------------------- similarly named type alias `v11` defined here
...
LL | pub const fn v21() -> v18 {}
| ^^^ help: a type alias with a similar name exists: `v11`
| ^^^
|
help: a type alias with a similar name exists
|
LL - pub const fn v21() -> v18 {}
LL + pub const fn v21() -> v11 {}
|

error[E0425]: cannot find type `v18` in this scope
--> $DIR/unevaluated-const-ice-119731.rs:35:31
Expand All @@ -29,7 +35,13 @@ LL | pub type v11 = [[usize; v4]; v4];
| --------------------------------- similarly named type alias `v11` defined here
...
LL | pub const fn v21() -> v18 {
| ^^^ help: a type alias with a similar name exists: `v11`
| ^^^
|
help: a type alias with a similar name exists
|
LL - pub const fn v21() -> v18 {
LL + pub const fn v21() -> v11 {
|

error[E0422]: cannot find struct, variant or union type `v18` in this scope
--> $DIR/unevaluated-const-ice-119731.rs:37:13
Expand All @@ -38,7 +50,13 @@ LL | pub type v11 = [[usize; v4]; v4];
| --------------------------------- similarly named type alias `v11` defined here
...
LL | v18 { _p: () }
| ^^^ help: a type alias with a similar name exists: `v11`
| ^^^
|
help: a type alias with a similar name exists
|
LL - v18 { _p: () }
LL + v11 { _p: () }
|

warning: type `v11` should have an upper camel case name
--> $DIR/unevaluated-const-ice-119731.rs:9:14
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ error[E0425]: cannot find value `B` in this scope
--> $DIR/parent_generics_of_nested_in_default.rs:1:30
|
LL | impl<const A: i32 = { || [0; B] }> Tr {}
| - ^ help: a const parameter with a similar name exists: `A`
| - ^
| |
| similarly named const parameter `A` defined here
|
help: a const parameter with a similar name exists
|
LL - impl<const A: i32 = { || [0; B] }> Tr {}
LL + impl<const A: i32 = { || [0; A] }> Tr {}
|

error: defaults for generic parameters are not allowed here
--> $DIR/parent_generics_of_nested_in_default.rs:1:6
Expand Down
8 changes: 7 additions & 1 deletion tests/ui/consts/const-eval/ice-unhandled-type-122191.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@ error[E0425]: cannot find function `value` in this scope
--> $DIR/ice-unhandled-type-122191.rs:9:5
|
LL | value()
| ^^^^^ help: a constant with a similar name exists: `VALUE`
| ^^^^^
...
LL | const VALUE: Foo = foo();
| ------------------------- similarly named constant `VALUE` defined here
|
help: a constant with a similar name exists
|
LL - value()
LL + VALUE()
|

error[E0308]: mismatched types
--> $DIR/ice-unhandled-type-122191.rs:17:9
Expand Down
16 changes: 14 additions & 2 deletions tests/ui/consts/const-pattern-rewrite-error-32086.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ LL | struct S(u8);
| ------------- similarly named tuple struct `S` defined here
...
LL | let C(a) = S(11);
| ^ help: a tuple struct with a similar name exists: `S`
| ^
|
help: a tuple struct with a similar name exists
|
LL - let C(a) = S(11);
LL + let S(a) = S(11);
|

error[E0532]: expected tuple struct or tuple variant, found constant `C`
--> $DIR/const-pattern-rewrite-error-32086.rs:7:9
Expand All @@ -14,7 +20,13 @@ LL | struct S(u8);
| ------------- similarly named tuple struct `S` defined here
...
LL | let C(..) = S(11);
| ^ help: a tuple struct with a similar name exists: `S`
| ^
|
help: a tuple struct with a similar name exists
|
LL - let C(..) = S(11);
LL + let S(..) = S(11);
|

error: aborting due to 2 previous errors

Expand Down
16 changes: 14 additions & 2 deletions tests/ui/delegation/bad-resolve.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ LL | fn bar() {}
| -------- similarly named associated function `bar` defined here
...
LL | reuse <F as Trait>::baz;
| ^^^ help: an associated function with a similar name exists: `bar`
| ^^^
|
help: an associated function with a similar name exists
|
LL - reuse <F as Trait>::baz;
LL + reuse <F as Trait>::bar;
|

error[E0425]: cannot find function `foo` in this scope
--> $DIR/bad-resolve.rs:35:11
Expand All @@ -68,7 +74,13 @@ LL | fn foo(&self, x: i32) -> i32 { x }
| ---------------------------- similarly named associated function `foo` defined here
...
LL | reuse Trait::foo2 { self.0 }
| ^^^^ help: an associated function with a similar name exists: `foo`
| ^^^^
|
help: an associated function with a similar name exists
|
LL - reuse Trait::foo2 { self.0 }
LL + reuse Trait::foo { self.0 }
|

error[E0046]: not all trait items implemented, missing: `Type`
--> $DIR/bad-resolve.rs:22:1
Expand Down
Loading
Loading