-
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
struct initialization incorrectly suggests using assoc function #115992
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
D-incorrect
Diagnostics: A diagnostic that is giving misleading or incorrect information.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
lcnr
added
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Sep 20, 2023
rustbot
added
the
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
label
Sep 20, 2023
This is two problems:
(2.) happens even without initializers: struct Foo {
field: u32,
}
impl Foo {
fn field(&self) -> u32 {
self.field
}
fn new() {
field;
}
}
|
compiler-errors
added
D-incorrect
Diagnostics: A diagnostic that is giving misleading or incorrect information.
and removed
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
labels
Sep 20, 2023
estebank
added a commit
to estebank/rust
that referenced
this issue
Sep 23, 2023
Tweak output. Fix rust-lang#115992.
estebank
added a commit
to estebank/rust
that referenced
this issue
Sep 23, 2023
Tweak output. Fix rust-lang#115992.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Sep 23, 2023
…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`
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Sep 23, 2023
…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``
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Sep 24, 2023
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``
estebank
added a commit
to estebank/rust
that referenced
this issue
Sep 25, 2023
Tweak output. Fix rust-lang#115992.
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Sep 29, 2023
…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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
D-incorrect
Diagnostics: A diagnostic that is giving misleading or incorrect information.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
We should not suggest using
self.field
inside of a struct initializer.The text was updated successfully, but these errors were encountered: