-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
suggest into_iter()
when Iterator
method called on impl IntoIterator
#119928
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @TaKO8Ki (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
r? compiler |
☔ The latest upstream changes (presumably #120722) made this pull request unmergeable. Please resolve the merge conflicts. |
e1b722b
to
6581eed
Compare
This comment has been minimized.
This comment has been minimized.
7b4201d
to
51a9e61
Compare
This comment has been minimized.
This comment has been minimized.
tcx.def_path_str(trait_pred.trait_ref.def_id) | ||
== tcx.def_path_str(into_iterator_trait) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you using string comparison here? Just compare the def ids directly.
tcx.def_path_str(trait_pred.trait_ref.def_id) | |
== tcx.def_path_str(into_iterator_trait) | |
trait_pred.trait_ref.def_id == into_iterator_trait |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, you can use is_diagnostic_item
} | ||
_ => return false, | ||
} | ||
false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this whole approach could be simplified by just checking if {ty}: IntoIterator
holds. You can use predicate_must_hold_modulo_regions
to do this.
51a9e61
to
e99766d
Compare
@bors r+ rollup |
…llaumeGomez Rollup of 6 pull requests Successful merges: - rust-lang#119928 (suggest `into_iter()` when `Iterator` method called on `impl IntoIterator`) - rust-lang#121020 (Avoid an ICE in diagnostics) - rust-lang#121111 (For E0038, suggest associated type if available) - rust-lang#121137 (Add clippy into the known `cfg` list) - rust-lang#121179 (allow mutable references in const values when they point to no memory) - rust-lang#121181 (Fix an ICE in the recursion lint) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#119928 - d-sonuga:into-iter-sugg, r=compiler-errors suggest `into_iter()` when `Iterator` method called on `impl IntoIterator` Fix for issue rust-lang#117711.
Fix for issue #117711.