diff options
| author | Hirochika Matsumoto <git@hkmatsumoto.com> | 2021-08-07 04:34:29 +0900 |
|---|---|---|
| committer | Hirochika Matsumoto <git@hkmatsumoto.com> | 2021-09-19 20:01:23 +0900 |
| commit | 21eff8f050b80e28309f72f659339ecfba2e0344 (patch) | |
| tree | bf165321dfdbb188cdb04e21ad3eea1361b4d2b3 /compiler/rustc_llvm/llvm-wrapper | |
| parent | 8e398f5ba77b283b529c0c61cc2313c4f82d61dd (diff) | |
| download | rust-21eff8f050b80e28309f72f659339ecfba2e0344.tar.gz rust-21eff8f050b80e28309f72f659339ecfba2e0344.zip | |
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
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper')
0 files changed, 0 insertions, 0 deletions
