-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Explain base expression for struct update syntax #106893
Conversation
r? @oli-obk (rustbot has picked a reviewer for you, use r? to override) |
cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki |
@@ -17,6 +17,8 @@ error: base expression required after `..` | |||
| | |||
LL | Struct { a, .. }; | |||
| ^ add a base expression here | |||
| | |||
= help: using struct update syntax requires a base expression of the same type as the struct to fill out the remaining fields |
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 does not seem helpful here -- we just need to mention that it needs a base expression at all 😆
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.
Maybe this can be made into a suggestion... e.g.
Struct { a, ../* expr */ }
++++++++++
.. using /* expr */
to signify that something needs to go there.
Alternatively, we could just give this error an actual E### number, and use |
@rustbot author |
☔ The latest upstream changes (presumably #103042) made this pull request unmergeable. Please resolve the merge conflicts. |
436f704
to
71cde38
Compare
Changed the help to a suggestion as suggested - possibly the label is redundant now, but the diagnostic looks a bit weird with the bare arrow. |
yeah! you should just follow these steps. if you don't want to i'd be happy to r+ this as is though. https://rustc-dev-guide.rust-lang.org/diagnostics/error-codes.html |
Failed to set assignee to
|
@clubby789 any updates on this? |
I'm recovering from an injury at the moment, but I'll try and get back to this one when I'm able - hopefully in a few days |
71cde38
to
1d774ff
Compare
Some changes occurred in diagnostic error codes |
This comment has been minimized.
This comment has been minimized.
1d774ff
to
23d1c9a
Compare
☔ The latest upstream changes (presumably #114208) made this pull request unmergeable. Please resolve the merge conflicts. |
23d1c9a
to
93813d8
Compare
☔ The latest upstream changes (presumably #119767) made this pull request unmergeable. Please resolve the merge conflicts. |
@rustbot ready |
93813d8
to
f1b8b7d
Compare
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.
r=me when green
@bors r=compiler-errors |
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#106893 (Explain base expression for struct update syntax) - rust-lang#119769 (rustdoc: offset generic args of cross-crate trait object types when cleaning) - rust-lang#119772 (Fix an ICE that occurs after an error has already been reported) - rust-lang#119782 (rint intrinsics: caution against actually trying to check for floating-point exceptions) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#106893 - clubby789:struct-update-help, r=compiler-errors Explain base expression for struct update syntax Fixes rust-lang#106890 `@rustbot` label +A-diagnostics
Fixes #106890
@rustbot label +A-diagnostics