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

Commits on Jan 30, 2024

  1. 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 rust-lang#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.
    nnethercote committed Jan 30, 2024
    Configuration menu
    Copy the full SHA
    4225a1e View commit details
    Browse the repository at this point in the history