-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
More accurate suggestion for self.
and Self::
#116086
Conversation
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 still doesn't give good suggestions for a resolver error w/ associated_fn_name
without ()
, right? If so, pls file a follow-up bug. r=me
This comment has been minimized.
This comment has been minimized.
Also, this doesn't fix the other half of #115992, which is that struct shorthand syntax gets mangled by suggestion in resolution, right? Should probably not close that issue if so. |
Would actually be nice if you committed the test in #115992 so I could see the answer to those two questions, even if those suggestions are still kinda busted. Could be marked w/ |
The output for the two cases is
Having the field and method named the same does add the somewhat misleading span though :-/ We could improve the situation by carrying more data in the diagnostic struct to mention more than one bit context, as we do now. I'll add the test. |
Oh boy, that's fun
|
I'll address the "keep info on struct literal around" later, I know where to fix it but will likely take me longer than tonight. |
@bors r=compiler-errors |
@bors rollup |
…errors More accurate suggestion for `self.` and `Self::` Detect that we can't suggest `self.` in an associated function without `&self` receiver. Partially address rust-lang#115992. r? `@compiler-errors`
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#116073 (Allow higher-ranked fn sigs in `ValuePairs`) - rust-lang#116082 (Tweak expected message to explain what it's actually signifying) - rust-lang#116086 (More accurate suggestion for `self.` and `Self::`) - rust-lang#116104 (Reuse calculate_debuginfo_offset for fragments.) - rust-lang#116106 (Migrate GUI colors test to original CSS color format) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#116086 - estebank:issue-115992, r=compiler-errors More accurate suggestion for `self.` and `Self::` Detect that we can't suggest `self.` in an associated function without `&self` receiver. Partially address rust-lang#115992. r? ``@compiler-errors``
…errors When suggesting `self.x` for `S { x }`, use `S { x: self.x }` Fix rust-lang#115992. r? `@compiler-errors` Follow up to rust-lang#116086.
Detect that we can't suggest
self.
in an associated function without&self
receiver.Partially address #115992.
r? @compiler-errors