-
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 associated method on deref types when path syntax method fails #100302
Conversation
r? @jackh726 (rust-highfive has picked a reviewer for you, use r? to override) |
&& pick.item.fn_has_self_parameter | ||
&& let Some(self_ty) = | ||
self.tcx.fn_sig(pick.item.def_id).inputs().skip_binder().get(0) | ||
&& self_ty.is_ref() |
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.
This is a bit of a strange heuristic, but it works pretty well. Part of the issue here is that we don't have type information for the self arg (yet), since we haven't called check_expr
.
This is a MaybeIncorrect
suggestion, so I think it's fine for it to be a bit incorrect, as long as it's not suggesting something wildly wrong.
☔ The latest upstream changes (presumably #101225) made this pull request unmergeable. Please resolve the merge conflicts. |
6dacc7d
to
5f0431b
Compare
This comment has been minimized.
This comment has been minimized.
d14a4f0
to
dfc8a00
Compare
This comment was marked as outdated.
This comment was marked as outdated.
dfc8a00
to
12a4952
Compare
@bors r+ |
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#100302 (Suggest associated method on deref types when path syntax method fails) - rust-lang#100647 ( Make trait bound not satisfied specify kind) - rust-lang#101349 (rustdoc: remove `.impl-items { flex-basis }` CSS, not in flex container) - rust-lang#101369 (Fix `global_asm` macro pretty printing) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #100278