-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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 parentheses for possible range method calling #102454
Suggest parentheses for possible range method calling #102454
Conversation
r? @TaKO8Ki (rust-highfive has picked a reviewer for you, use r? to override) |
5039d7e
to
04e6dc4
Compare
This comment has been minimized.
This comment has been minimized.
6c0766b
to
2e717c6
Compare
5ee7bdb
to
348d082
Compare
348d082
to
86947ab
Compare
cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki |
☔ The latest upstream changes (presumably #102395) made this pull request unmergeable. Please resolve the merge conflicts. |
17f2311
to
c141b82
Compare
c141b82
to
854844e
Compare
854844e
to
e747201
Compare
r? @lcnr |
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.
some small nits, then r=me
let pick = | ||
self.lookup_probe(span, item_name, range_ty, expr, ProbeScope::AllTraits); |
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.
can you emit a comment for why we're using ProbeScope::AllTraits
here, I remember that you mentioned the reason for that before but I forgot that again 😁
also, i think ideally we would use probe_for_name
directly here with IsSuggestion(true)
. Not sure what IsSuggestion
does but we are emitting a suggestion here, so setting that to true seems like it should be done 😅
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.
Seems IsSuggestion
only used at here:
if !self.is_suggestion.0 && !unstable_candidates.is_empty() { |
Use ProbeScope::TraitsInScope
can not find the pick, but ProbeScope::AllTraits
will find it.
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.
it seems helpful to not emit unstable_name_collision_hint
s while looking for diagnostics, so that should still be done.
ProbeScope::TraitsInScope
that feels weird and shouldn't be the case as Iterator
is in scope. Is this still the case with the current code?
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.
updated the code to use probe_for_name
.
ProbeScope::TraitsInScope
means find with the scope of expr
,
probe_cx.assemble_extension_candidates_for_traits_in_scope(scope_expr_id) |
othewise try to find methods in all traits.
At this function, we are at a point of error handling of range type checking, since error happened so the Iterator
is not in the scope? it's only my guess😁
@bors r+ rollup |
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#102454 (Suggest parentheses for possible range method calling) - rust-lang#102466 (only allow `ConstEquate` with `feature(gce)`) - rust-lang#102945 (Do not register placeholder `RegionOutlives` obligations when `considering_regions` is false) - rust-lang#103091 (rustdoc: remove unused HTML class `sidebar-title`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #102396