Skip to content

Commit 7836678

Browse files
authoredJan 31, 2024
Rollup merge of #120490 - nnethercote:Diagnostic-hashing, r=estebank
Don't hash lints differently to non-lints. `Diagnostic::keys`, which is used for hashing and equating diagnostics, has a surprising behaviour: it ignores children, but only for lints. This was added in #88493 to fix some duplicated diagnostics, but it doesn't seem necessary any more. This commit removes the special case and only four tests have changed output, with additional errors. And those additional errors aren't exact duplicates, they're just similar. For example, in src/tools/clippy/tests/ui/same_name_method.rs we currently have this error: ``` error: method's name is the same as an existing method in a trait --> $DIR/same_name_method.rs:75:13 | LL | fn foo() {} | ^^^^^^^^^^^ | note: existing `foo` defined here --> $DIR/same_name_method.rs:79:9 | LL | impl T1 for S {} | ^^^^^^^^^^^^^^^^ ``` and with this change we also get this error: ``` error: method's name is the same as an existing method in a trait --> $DIR/same_name_method.rs:75:13 | LL | fn foo() {} | ^^^^^^^^^^^ | note: existing `foo` defined here --> $DIR/same_name_method.rs:81:9 | LL | impl T2 for S {} | ``` I think printing this second argument is reasonable, possibly even preferable to hiding it. And the other cases are similar. r? `@estebank`
2 parents 9e3bb89 + ae0f0fd commit 7836678

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed
 

‎tests/ui/same_name_method.rs

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ mod should_lint {
7474
impl S {
7575
fn foo() {}
7676
//~^ ERROR: method's name is the same as an existing method in a trait
77+
//~| ERROR: method's name is the same as an existing method in a trait
7778
}
7879

7980
impl T1 for S {}

‎tests/ui/same_name_method.stderr

+14-2
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,22 @@ LL | fn foo() {}
5656
| ^^^^^^^^^^^
5757
|
5858
note: existing `foo` defined here
59-
--> $DIR/same_name_method.rs:79:9
59+
--> $DIR/same_name_method.rs:80:9
6060
|
6161
LL | impl T1 for S {}
6262
| ^^^^^^^^^^^^^^^^
6363

64-
error: aborting due to 5 previous errors
64+
error: method's name is the same as an existing method in a trait
65+
--> $DIR/same_name_method.rs:75:13
66+
|
67+
LL | fn foo() {}
68+
| ^^^^^^^^^^^
69+
|
70+
note: existing `foo` defined here
71+
--> $DIR/same_name_method.rs:82:9
72+
|
73+
LL | impl T2 for S {}
74+
| ^^^^^^^^^^^^^^^^
75+
76+
error: aborting due to 6 previous errors
6577

0 commit comments

Comments
 (0)