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

Explain base expression for struct update syntax #106893

Merged
merged 1 commit into from
Jan 10, 2024

Conversation

clubby789
Copy link
Contributor

@clubby789 clubby789 commented Jan 15, 2023

Fixes #106890

@rustbot label +A-diagnostics

@rustbot
Copy link
Collaborator

rustbot commented Jan 15, 2023

r? @oli-obk

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 15, 2023
@rustbot
Copy link
Collaborator

rustbot commented Jan 15, 2023

rustc_error_messages was changed

cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki

@rustbot rustbot added the A-diagnostics Area: Messages for errors, warnings, and lints label Jan 15, 2023
@@ -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
Copy link
Member

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 😆

Copy link
Member

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.

@compiler-errors
Copy link
Member

Alternatively, we could just give this error an actual E### number, and use --explain to specify what the proper fix for this issue is. That might be better than making the diagnostic here more verbose.

@clubby789
Copy link
Contributor Author

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 23, 2023
@bors
Copy link
Contributor

bors commented Feb 22, 2023

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

@rust-cloud-vms rust-cloud-vms bot force-pushed the struct-update-help branch 2 times, most recently from 436f704 to 71cde38 Compare May 26, 2023 13:51
@clubby789
Copy link
Contributor Author

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.
An error code could also be added, just unsure of the process

@compiler-errors
Copy link
Member

compiler-errors commented May 26, 2023

An error code could also be added, just unsure of the process

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

@oli-obk
Copy link
Contributor

oli-obk commented May 26, 2023

r? @compiler-errors

@rustbot
Copy link
Collaborator

rustbot commented May 26, 2023

Failed to set assignee to compiler-errors: cannot assign: error sending request for url (https://api.github.com/repos/rust-lang/rust/issues/106893/assignees): connection closed before message completed

Note: Only org members, users with write permissions, or people who have commented on the PR may be assigned.

@Dylan-DPC
Copy link
Member

@clubby789 any updates on this?

@clubby789
Copy link
Contributor Author

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

@rustbot
Copy link
Collaborator

rustbot commented Oct 14, 2023

Some changes occurred in diagnostic error codes

cc @GuillaumeGomez

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Nov 1, 2023

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

@bors
Copy link
Contributor

bors commented Jan 9, 2024

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

@clubby789
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 9, 2024
Copy link
Member

@compiler-errors compiler-errors left a 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

@clubby789
Copy link
Contributor Author

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Jan 9, 2024

📌 Commit f1b8b7d has been approved by compiler-errors

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 Jan 9, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 10, 2024
…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
@bors bors merged commit 33f27d3 into rust-lang:master Jan 10, 2024
11 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 10, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 10, 2024
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
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 A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic 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.

not clear what "base expression" is
8 participants