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

Fix issue with autofix for ambiguous associated function from Rust 2021 prelude when struct is generic #87557

Merged
merged 1 commit into from
Jul 30, 2021

Conversation

rylev
Copy link
Member

@rylev rylev commented Jul 28, 2021

Fixes #86940

The test cases and associated issue should make it clear what specifically this is meant to fix. The fix is slightly hacky in that we check against the literal source code of the call site for the presence of < in order to determine if the user has included the generics for the struct (meaning we don't need to include them for them).

r? @nikomatsakis

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 28, 2021
@rylev rylev added A-edition-2021 Area: The 2021 edition D-edition Diagnostics: An error or lint that should account for edition differences. labels Jul 28, 2021
Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me with comment

@nikomatsakis
Copy link
Contributor

@bors delegate+

@bors
Copy link
Contributor

bors commented Jul 30, 2021

✌️ @rylev can now approve this pull request

@rylev rylev force-pushed the fix-invalid-prelude-collision-error branch from be1a9ae to 578fcbd Compare July 30, 2021 15:19
@rylev
Copy link
Member Author

rylev commented Jul 30, 2021

@bors r=nikomatsakis

@bors
Copy link
Contributor

bors commented Jul 30, 2021

📌 Commit 578fcbd has been approved by nikomatsakis

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 30, 2021
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Jul 30, 2021
…-error, r=nikomatsakis

Fix issue with autofix for ambiguous associated function from Rust 2021 prelude when struct is generic

Fixes rust-lang#86940

The test cases and associated issue should make it clear what specifically this is meant to fix. The fix is slightly hacky in that we check against the literal source code of the call site for the presence of `<` in order to determine if the user has included the generics for the struct (meaning we don't need to include them for them).

r? `@nikomatsakis`
This was referenced Jul 30, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 30, 2021
Rollup of 9 pull requests

Successful merges:

 - rust-lang#86072 (Cross compiling rustc_llvm on Darwin requires zlib.)
 - rust-lang#87385 (Make `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` warn by default)
 - rust-lang#87547 (Add missing examples for NonNull)
 - rust-lang#87557 (Fix issue with autofix for ambiguous associated function from Rust 2021 prelude when struct is generic)
 - rust-lang#87559 (Tweak borrowing suggestion in `for` loop)
 - rust-lang#87596 (Add warning when whitespace is not skipped after an escaped newline)
 - rust-lang#87606 (Add some TAIT-related regression tests)
 - rust-lang#87609 (Add docs about performance and `Iterator::map` to `[T; N]::map`)
 - rust-lang#87616 (Fix missing word in rustdoc book)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit fb27c4c into rust-lang:master Jul 30, 2021
@rustbot rustbot added this to the 1.56.0 milestone Jul 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-edition-2021 Area: The 2021 edition D-edition Diagnostics: An error or lint that should account for edition differences. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prelude collision lint: invalid suggestion for T::from_iter when T is generic.
5 participants