Suggest use .. to fill in the rest of the fields of Struct#103012
Suggest use .. to fill in the rest of the fields of Struct#103012bors merged 3 commits intorust-lang:masterfrom
Conversation
|
cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki |
|
r? @eholk (rust-highfive has picked a reviewer for you, use r? to override) |
b2eebf6 to
1b1ce40
Compare
There was a problem hiding this comment.
Looking better!
Can you actually set the base expression like above? Something like base = ast::StructRest::Base(e). Basically emulate the code above. That should suppress the "missing fields x and y in initializer of V3" error below.
Also, can handle the case of ... } like above?
There was a problem hiding this comment.
oo, I left the "missing fields x and y in initializer of V3" intentionally, I thought it may helpful for let developer know which fields are missing.
And for the case of ...}, we need to suggest something like ..{expr}? So I left it as before also.
There was a problem hiding this comment.
I thought it may helpful for let developer know which fields are missing.
This is extra noise if the developer wrote ... instead of .., which is what your PR is trying to fix, right? 😆
And for the case of
...}, we need to suggest something like..{expr}?
Not in the case of a pattern, which is the same place that .. } is valid.
Basically, we should treat ... typo as closely to .. as possible, especially if we're "recovering" parsing here.
There was a problem hiding this comment.
It may actually be easier to merge this check with the .. logic above, since we're basically just duplicating that.
There was a problem hiding this comment.
Ok, I will make a update.
There was a problem hiding this comment.
For the case of let V3 { z: val, ...} = v, we already have a check to report:
error: expected field pattern, found `...`
--> /home/cat/code/rust/src/test/ui/parser/issue-102806.rs:23:22
|
23 | let V3 { z: val, ... } = v;
| ^^^ help: to omit remaining fields, use one fewer `.`: `..`Will keep same as before.
There was a problem hiding this comment.
It may actually be easier to merge this check with the
..logic above, since we're basically just duplicating that.
Tried to merge the two checks, but I found split them seems more easy to read.
There was a problem hiding this comment.
That's ok, I don't think it's necessary
There was a problem hiding this comment.
Finally, merge it with the .. logic above 😁
|
r? @compiler-errors I can take over this review, and seems like @chenyukang almost has this ready 😸 |
|
Hi, I've seen you changed some diagnostic structs in your PR. After #103345, the way we refer to fluent messages changed. They are now in a flat namespace with the same identifier as in the fluent file. For example, |
This comment was marked as resolved.
This comment was marked as resolved.
5600243 to
b0cd3d4
Compare
Rebased update. |
|
Could not assign reviewer from: |
b0cd3d4 to
38fe8ad
Compare
Should be Since I saw you doing |
Thanks for tip 😁. @rustbot ready |
davidtwco
left a comment
There was a problem hiding this comment.
r=me,compiler-errors after one comment
29a4924 to
4b77e73
Compare
|
@chenyukang: 🔑 Insufficient privileges: Not in reviewers |
|
@bors r=davidtwco,compiler-errors I hope you didn't mind me renaming the function typo, but I didn't want to delay r+'ing still since I know you have been waiting 😄 |
Thanks very much. |
…,compiler-errors Suggest use .. to fill in the rest of the fields of Struct Fixes rust-lang#102806
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#103012 (Suggest use .. to fill in the rest of the fields of Struct) - rust-lang#103851 (Fix json flag in bootstrap doc) - rust-lang#103990 (rustdoc: clean up `.logo-container` layout CSS) - rust-lang#104002 (fix a comment in UnsafeCell::new) - rust-lang#104014 (Migrate test-arrow to CSS variables) - rust-lang#104016 (Add internal descriptions to a few queries) - rust-lang#104035 (Add 'closure match' test to weird-exprs.rs.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #102806