mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-01 12:37:37 +00:00
![]() 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 |
||
---|---|---|
.. | ||
attr_wrapper.rs | ||
attr.rs | ||
diagnostics.rs | ||
expr.rs | ||
generics.rs | ||
item.rs | ||
mod.rs | ||
nonterminal.rs | ||
pat.rs | ||
path.rs | ||
stmt.rs | ||
ty.rs |