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

Suggest associated method on deref types when path syntax method fails #100302

Merged
merged 1 commit into from Sep 4, 2022

Conversation

compiler-errors
Copy link
Member

Fixes #100278

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Aug 9, 2022
@rust-highfive
Copy link
Collaborator

r? @jackh726

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 9, 2022
Comment on lines +1658 to +1681
&& 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()
Copy link
Member Author

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.

@bors
Copy link
Contributor

bors commented Aug 31, 2022

☔ The latest upstream changes (presumably #101225) made this pull request unmergeable. Please resolve the merge conflicts.

@rust-log-analyzer

This comment has been minimized.

@compiler-errors compiler-errors force-pushed the deref-path-methods branch 2 times, most recently from d14a4f0 to dfc8a00 Compare September 3, 2022 07:15
@rustbot

This comment was marked as outdated.

@jackh726
Copy link
Contributor

jackh726 commented Sep 3, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Sep 3, 2022

📌 Commit 12a4952 has been approved by jackh726

It is now in the queue for this repository.

@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 Sep 3, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 4, 2022
…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
@bors bors merged commit bd9750f into rust-lang:master Sep 4, 2022
@rustbot rustbot added this to the 1.65.0 milestone Sep 4, 2022
@compiler-errors compiler-errors deleted the deref-path-methods branch August 11, 2023 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using non-existent associated method doesn't hint about deref
6 participants