diff options
| author | bors <bors@rust-lang.org> | 2022-08-14 01:29:58 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-08-14 01:29:58 +0000 |
| commit | b76fec3ca89ba255316c010065f1fcf4d7cbfc9c (patch) | |
| tree | cba22d8a87a62adfc69df8238b4658bcae39c783 /compiler/rustc_parse | |
| parent | 75b7e52e92c3b00fc891b47f5b2efdff0a2be55a (diff) | |
| parent | 860e093efb78ff67ae7f2cb9bbb69637295214a4 (diff) | |
| download | rust-b76fec3ca89ba255316c010065f1fcf4d7cbfc9c.tar.gz rust-b76fec3ca89ba255316c010065f1fcf4d7cbfc9c.zip | |
Auto merge of #100511 - compiler-errors:rollup-vrte4w5, r=compiler-errors
Rollup of 11 pull requests Successful merges: - #100355 (rustdoc: Rename ``@has` FILE PATTERN` to ``@hasraw` FILE PATTERN`) - #100407 (avoid some int2ptr casts in thread_local_key tests) - #100434 (Fix HIR pretty printing of let else) - #100438 (Erase regions better in `promote_candidate`) - #100445 (adapt test for msan message change) - #100447 (Remove more Clean trait implementations) - #100464 (Make `[rust] use-lld=true` work on windows) - #100475 (Give a helpful diagnostic when the next struct field has an attribute) - #100490 (wf: correctly `shallow_resolve` consts) - #100501 (nicer Miri backtraces for from_exposed_addr) - #100509 (merge two test directories that mean the same thing) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse')
| -rw-r--r-- | compiler/rustc_parse/src/parser/item.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 197c0384898..ac55aee9883 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -1544,8 +1544,12 @@ impl<'a> Parser<'a> { } } - if self.token.is_ident() { - // This is likely another field; emit the diagnostic and keep going + if self.token.is_ident() + || (self.token.kind == TokenKind::Pound + && (self.look_ahead(1, |t| t == &token::OpenDelim(Delimiter::Bracket)))) + { + // This is likely another field, TokenKind::Pound is used for `#[..]` attribute for next field, + // emit the diagnostic and keep going err.span_suggestion( sp, "try adding a comma", |
