fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #71365 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4fb7144ed15

1.43.0
684 B37 linesraw
1// run-rustfix
2
3#![allow(warnings)]
4
5// This test checks that the following error is emitted when a `=` character is used to initialize
6// a struct field when a `:` is expected.
7//
8// ```
9// error: struct fields are initialized with a colon
10//   --> $DIR/issue-57684.rs:12:20
11//    |
12// LL |     let _ = X { f1 = 5 };
13//    |                    ^ help: replace equals symbol with a colon: `:`
14// ```
15
16struct X {
17    f1: i32,
18}
19
20struct Y {
21    f1: i32,
22    f2: i32,
23    f3: i32,
24}
25
26fn main() {
27    let _ = X { f1: 5 };
28    //~^ ERROR expected `:`, found `=`
29
30    let f3 = 3;
31    let _ = Y {
32        f1: 5,
33        //~^ ERROR expected `:`, found `=`
34        f2: 4,
35        f3,
36    };
37}