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

Use new inner attribute syntax everywhere #13493

Merged
merged 1 commit into from
Apr 14, 2014

Conversation

Manishearth
Copy link
Member

See #13478

bors added a commit that referenced this pull request Apr 14, 2014
@bors bors closed this Apr 14, 2014
@bors bors merged commit 713e875 into rust-lang:master Apr 14, 2014
@Manishearth Manishearth deleted the newattr-everywhere branch January 10, 2015 21:22
flip1995 pushed a commit to flip1995/rust that referenced this pull request Oct 18, 2024
…r=Manishearth

Compare trait references in `trait_duplication_in_bounds` correctly

Fixes rust-lang#13476
Fixes rust-lang#11067
Fixes rust-lang#9915
Fixes rust-lang#9626

Currently, the `trait_duplication_in_bounds` lints has a helper type for a trait reference that can be used for comparison and hashing, represented as `{trait: Res, generic_args: Vec<Res>}`. However, there are a lot of issues with this. For one, a `Res` can't represent e.g. references, slices, or lots of other types, as well as const generics and associated type equality. In those cases, the lint simply ignores them and has no way of checking if they're actually the same.

So, instead of using `Res` for this, use `SpanlessEq` and `SpanlessHash` for comparisons with the trait path for checking if there are duplicates.

However, using `SpanlessEq` as is alone lead to a false negative in the test. `std::clone::Clone` + `foo::Clone` wasn't recognized as a duplicate, because it has different segments. So this also adds a new "mode" to SpanlessEq which compares by final resolution. (I've been wondering if this can't just be the default but it's quite a large scale change as it affects a lot of lints and I haven't yet looked at all uses of it to see if there are lints that really do care about having exactly the same path segments).

Maybe an alternative would be to turn the hir types/consts into middle types/consts and compare them instead but I'm not sure there's really a good way to do that

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants