rust/compiler/rustc_parse/src/parser
Hirochika Matsumoto 21eff8f050 Suggest replacing braces for brackets on array-esque invalid block expr
Newcomers may write `{1, 2, 3}` for making arrays, and the current error
message is not informative enough to quickly convince them what is
needed to fix the error.
This PR implements a diagnostic for this case, and its output looks like
this:
```text
error: this code is interpreted as a block expression, not an array
 --> src/lib.rs:1:22
  |
1 |   const FOO: [u8; 3] = {
  |  ______________________^
2 | |     1, 2, 3
3 | | };
  | |_^
  |
  = note: to define an array, one would use square brackets instead of curly braces
help: try using [] instead of {}
  |
1 | const FOO: [u8; 3] = [
2 |     1, 2, 3
3 | ];
  |
```

Fix #87672
2021-09-19 20:01:23 +09:00
..
attr_wrapper.rs Change more x64 size checks to not apply to x32. 2021-09-05 16:42:36 +01:00
attr.rs Provide more context on incorrect inner attribute 2021-09-02 19:08:30 +00:00
diagnostics.rs Rollup merge of #87566 - JohnTitor:find-eqeq-on-assoc-type-bounds, r=estebank 2021-09-17 17:41:14 +02:00
expr.rs Suggest replacing braces for brackets on array-esque invalid block expr 2021-09-19 20:01:23 +09:00
generics.rs Require passing an AttrWrapper to collect_tokens_trailing_token 2021-02-13 12:07:15 -05:00
item.rs Rollup merge of #88775 - pnkfelix:revert-anon-union-parsing, r=davidtwco 2021-09-15 14:56:58 -07:00
mod.rs Emit proper errors on missing closure braces 2021-09-09 17:44:40 +02:00
nonterminal.rs Use if-let guards in the codebase 2021-08-25 20:24:35 +02:00
pat.rs Use multispan suggestions more often 2021-07-30 09:26:31 -07:00
path.rs Fix handling of unmatched angle brackets in parser 2021-06-05 00:31:28 +02:00
stmt.rs Rollup merge of #88690 - m-ou-se:macro-braces-dot-question-expr-parse, r=nagisa 2021-09-15 14:56:57 -07:00
ty.rs Revert "Implement Anonymous{Struct, Union} in the AST" 2021-09-09 09:14:17 -04:00