diff options
| author | bors <bors@rust-lang.org> | 2021-09-21 00:34:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-09-21 00:34:10 +0000 |
| commit | e7958d35ca2c898a223efe402481e0ecb854310a (patch) | |
| tree | 9bb8ad5fa75707ff579d9402e28532c3f12590ce /src/test/rustdoc/intra-doc/prim-methods-external-core.rs | |
| parent | 60e70cc909f84e84ed3bca3fe3459ddceefdd08c (diff) | |
| parent | 21eff8f050b80e28309f72f659339ecfba2e0344 (diff) | |
| download | rust-e7958d35ca2c898a223efe402481e0ecb854310a.tar.gz rust-e7958d35ca2c898a223efe402481e0ecb854310a.zip | |
Auto merge of #87830 - hkmatsumoto:suggest-brackets-for-array-esque-block-expr, r=estebank
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 'src/test/rustdoc/intra-doc/prim-methods-external-core.rs')
0 files changed, 0 insertions, 0 deletions
