Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't hash lints differently to non-lints. #120490

Merged
merged 1 commit into from
Jan 31, 2024
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
16 changes: 8 additions & 8 deletions compiler/rustc_errors/src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ pub struct Diagnostic {
/// `span` if there is one. Otherwise, it is `DUMMY_SP`.
pub sort_span: Span,

/// If diagnostic is from Lint, custom hash function ignores children.
/// Otherwise hash is based on the all the fields.
pub is_lint: Option<IsLint>,

/// With `-Ztrack_diagnostics` enabled,
Expand Down Expand Up @@ -980,22 +978,24 @@ impl Diagnostic {
) -> (
&Level,
&[(DiagnosticMessage, Style)],
Vec<(&Cow<'static, str>, &DiagnosticArgValue)>,
&Option<ErrCode>,
&Option<IsLint>,
&MultiSpan,
&[SubDiagnostic],
&Result<Vec<CodeSuggestion>, SuggestionsDisabled>,
Option<&[SubDiagnostic]>,
Vec<(&DiagnosticArgName, &DiagnosticArgValue)>,
&Option<IsLint>,
) {
(
&self.level,
&self.messages,
self.args().collect(),
&self.code,
&self.is_lint,
&self.span,
&self.children,
&self.suggestions,
(if self.is_lint.is_some() { None } else { Some(&self.children) }),
self.args().collect(),
// omit self.sort_span
&self.is_lint,
// omit self.emitted_at
)
}
}
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui/same_name_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ mod should_lint {
impl S {
fn foo() {}
//~^ ERROR: method's name is the same as an existing method in a trait
//~| ERROR: method's name is the same as an existing method in a trait
}

impl T1 for S {}
Expand Down
16 changes: 14 additions & 2 deletions src/tools/clippy/tests/ui/same_name_method.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,22 @@ LL | fn foo() {}
| ^^^^^^^^^^^
|
note: existing `foo` defined here
--> $DIR/same_name_method.rs:79:9
--> $DIR/same_name_method.rs:80:9
|
LL | impl T1 for S {}
| ^^^^^^^^^^^^^^^^

error: aborting due to 5 previous errors
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:82:9
|
LL | impl T2 for S {}
| ^^^^^^^^^^^^^^^^

error: aborting due to 6 previous errors

3 changes: 0 additions & 3 deletions tests/rustdoc-ui/unescaped_backticks.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ LL | | /// level changes.
= help: if you meant to use a literal backtick, escape it
change: or `None` if it isn't.
to this: or `None\` if it isn't.
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error: unescaped backtick
--> $DIR/unescaped_backticks.rs:323:5
Expand All @@ -322,7 +321,6 @@ LL | | /// level changes.
= help: if you meant to use a literal backtick, escape it
change: `on_event` should be called.
to this: `on_event\` should be called.
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error: unescaped backtick
--> $DIR/unescaped_backticks.rs:323:5
Expand All @@ -342,7 +340,6 @@ LL | | /// level changes.
= help: if you meant to use a literal backtick, escape it
change: [`rebuild_interest_cache`][rebuild] is called after the value of the max
to this: [`rebuild_interest_cache\`][rebuild] is called after the value of the max
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error: unescaped backtick
--> $DIR/unescaped_backticks.rs:349:56
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ help: the constant being evaluated
|
LL | const Y: u32 = simple_loop(35);
| ^^^^^^^^^^^^
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

warning: constant evaluation is taking a long time
--> $DIR/ctfe-simple-loop.rs:9:5
Expand Down
1 change: 0 additions & 1 deletion tests/ui/imports/ambiguous-9.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ note: `date_range` could also refer to the function imported here
LL | use prelude::*;
| ^^^^^^^^^^
= help: consider adding an explicit import of `date_range` to disambiguate
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

warning: 4 warnings emitted

Loading