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 attribute syntax in tutorials. #13476

Closed
Manishearth opened this issue Apr 12, 2014 · 0 comments
Closed

Use new attribute syntax in tutorials. #13476

Manishearth opened this issue Apr 12, 2014 · 0 comments

Comments

@Manishearth
Copy link
Member

Recently the #[something]; syntax for inner attributes was changed to #![something]. The tutorials still use the old syntax, however.

@Manishearth Manishearth reopened this Apr 14, 2014
Dylan-DPC pushed a commit to Dylan-DPC/rust that referenced this issue Nov 1, 2022
fix: Don't respond with an error when requesting a shutdown while starting
flip1995 pushed a commit to flip1995/rust that referenced this issue 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

No branches or pull requests

1 participant