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