8000 Rollup of 5 pull requests by Dylan-DPC · Pull Request #99210 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Rollup of 5 pull requests #99210

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

Merged
merged 36 commits into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2a899dc
`UnsafeCell` now has no niches, ever.
oli-obk Jul 7, 2022
8d9f609
Comment update
oli-obk Jul 7, 2022
d496a4f
diagnostics: mention the `:` token when struct fields fail to parse
notriddle Jul 7, 2022
6713dde
diagnostics: suggest naming a field after failing to parse
notriddle Jul 7, 2022
4bfba76
Add tests for libstd types
oli-obk Jul 8, 2022
69b1b3c
Create a custom layout path for UnsafeCell instead of piggy backing o…
oli-obk Jul 8, 2022
4239155
More obvious closure name
oli-obk Jul 11, 2022
984db78
Hide niches in SIMD types, too
oli-obk Jul 11, 2022
3f4cf59
Move checks to compile-time
oli-obk Jul 11, 2022
af8536e
Simplify assertion macro
oli-obk Jul 11, 2022
fef596f
Rename assertion macro
oli-obk Jul 11, 2022
9a20450
Show sizes in error output
oli-obk Jul 11, 2022
fcd7207
Make tests work on 32 bit and 64 bit
oli-obk Jul 11, 2022
8440208
tidy
oli-obk Jul 11, 2022
e51f1b7
Keep unstable target features for asm feature checking
Amanieu Jul 11, 2022
dfe68ee
Add test for issue 99071
Amanieu Jul 11, 2022
d935c70
Don't allow accidental runtime-checks
oli-obk Jul 11, 2022
cdd6bba
Simplify size checking
oli-obk Jul 11, 2022
0318b70
tidy
oli-obk Jul 11, 2022
3338593
Only check relative sizes on platform specific types
oli-obk Jul 11, 2022
6c529de
lower let-else in MIR instead
dingxiangfei2009 Jun 2, 2022
1cd30e7
move else block into the `Local` struct
dingxiangfei2009 Jul 5, 2022
8e4a971
extract method to read scrutinee conditionally
dingxiangfei2009 Jul 11, 2022
5374688
add tests for async await
dingxiangfei2009 Jul 11, 2022
24e8796
Use some more visible sigils than `,`
oli-obk Jul 12, 2022
7269196
Always check Cell alongside with `UnsafeCell`
oli-obk Jul 12, 2022
947cbda
fix the typo
dingxiangfei2009 Jul 12, 2022
9fcb9c6
Update compiler/rustc_parse/src/parser/expr.rs
notriddle Jul 12, 2022
5188bdb
remove an unnecessary `span_to_snippet`
TaKO8Ki Jul 13, 2022
f65bf0b
avoid `&str` to `String` conversions
TaKO8Ki Jul 13, 2022
519c07b
Limit test to x86 targets for reproducability
oli-obk Jul 13, 2022
0083cd2
Rollup merge of #98574 - dingxiangfei2009:let-else-thir, r=oli-obk
Dylan-DPC Jul 13, 2022
1e7d04b
Rollup merge of #99011 - oli-obk:UnsoundCell, r=eddyb
Dylan-DPC Jul 13, 2022
980579a
Rollup merge of #99030 - rust-lang:notriddle/field-recovery, r=petroc…
Dylan-DPC Jul 13, 2022
68cfdbb
Rollup merge of #99155 - Amanieu:unstable-target-features, r=davidtwco
Dylan-DPC Jul 13, 2022
3933b2b
Rollup merge of #99199 - TaKO8Ki:remove-unnecessary-span-to-snippet, …
Dylan-DPC Jul 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
diagnostics: suggest naming a field after failing to parse
  • Loading branch information
notriddle committed Jul 7, 2022
commit 6713dde898ef81042a51d940d36150c52cb697b6
13 changes: 13 additions & 0 deletions compiler/rustc_parse/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3037,6 +3037,19 @@ impl<'a> Parser<'a> {
",",
Applicability::MachineApplicable,
);
} else if is_shorthand
&& (AssocOp::from_token(&self.token).is_some()
|| matches!(&self.token.kind, token::OpenDelim(_))
|| self.token.kind == token::Dot)
{
// Looks like they tried to write a shorthand, complex expression.
let ident = parsed_field.expect("is_shorthand implies Some").ident;
e.span_suggestion(
ident.span.shrink_to_lo(),
"try naming a field",
&format!("{ident}: "),
Applicability::HasPlaceholders,
);
}
}
if !recover {
Expand Down
5 changes: 3 additions & 2 deletions src/test/ui/parser/issues/issue-52496.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ error: expected one of `,`, `:`, or `}`, found `.`
--> $DIR/issue-52496.rs:8:22
|
LL | let _ = Foo { bar.into(), bat: -1, . };
| --- ^ expected one of `,`, `:`, or `}`
| |
| --- - ^ expected one of `,`, `:`, or `}`
| | |
| | help: try naming a field: `bar:`
| while parsing this struct

error: expected identifier, found `.`
Expand Down
14 changes: 11 additions & 3 deletions src/test/ui/parser/issues/issue-62973.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,19 @@ error: expected one of `,`, `:`, or `}`, found `{`
--> $DIR/issue-62973.rs:6:8
|
LL | fn p() { match s { v, E { [) {) }
| ^ - -^ expected one of `,`, `:`, or `}`
| | | |
| | | help: `}` may belong here
| ^ - ^ expected one of `,`, `:`, or `}`
| | |
| | while parsing this struct
| unclosed delimiter
|
help: `}` may belong here
|
LL | fn p() { match s { v, E} { [) {) }
| +
help: try naming a field
|
LL | fn p() { match s { v, E: E { [) {) }
| ++

error: struct literals are not allowed here
--> $DIR/issue-62973.rs:6:16
Expand Down
0