|
| 1 | +error[E0423]: expected function, tuple struct or tuple variant, found struct `PersonOnlyName` |
| 2 | + --> $DIR/struct-construct-with-call-issue-138931.rs:14:19 |
| 3 | + | |
| 4 | +LL | / struct PersonOnlyName { |
| 5 | +LL | | name: String |
| 6 | +LL | | } |
| 7 | + | |_- `PersonOnlyName` defined here |
| 8 | +... |
| 9 | +LL | let wilfred = PersonOnlyName("Name1".to_owned()); |
| 10 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `PersonOnlyName { name: val }` |
| 11 | + |
| 12 | +error[E0423]: expected function, tuple struct or tuple variant, found struct `PersonWithAge` |
| 13 | + --> $DIR/struct-construct-with-call-issue-138931.rs:17:16 |
| 14 | + | |
| 15 | +LL | / struct PersonWithAge { |
| 16 | +LL | | name: String, |
| 17 | +LL | | age: u8, |
| 18 | +LL | | height: u8, |
| 19 | +LL | | } |
| 20 | + | |_- `PersonWithAge` defined here |
| 21 | +... |
| 22 | +LL | let bill = PersonWithAge( |
| 23 | + | ________________^ |
| 24 | +LL | | "Name2".to_owned(), |
| 25 | +LL | | 20, |
| 26 | +LL | | 180, |
| 27 | +LL | | ); |
| 28 | + | |_____^ help: use struct literal syntax instead: `PersonWithAge { name: val, age: val, height: val }` |
| 29 | + |
| 30 | +error[E0423]: expected function, tuple struct or tuple variant, found struct `PersonWithAge` |
| 31 | + --> $DIR/struct-construct-with-call-issue-138931.rs:23:18 |
| 32 | + | |
| 33 | +LL | / struct PersonWithAge { |
| 34 | +LL | | name: String, |
| 35 | +LL | | age: u8, |
| 36 | +LL | | height: u8, |
| 37 | +LL | | } |
| 38 | + | |_- `PersonWithAge` defined here |
| 39 | +... |
| 40 | +LL | let person = PersonWithAge("Name3".to_owned()); |
| 41 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `PersonWithAge { name: val, age: val, height: val }` |
| 42 | + |
| 43 | +error: aborting due to 3 previous errors |
| 44 | + |
| 45 | +For more information about this error, try `rustc --explain E0423`. |
0 commit comments