mirror of https://github.com/rust-lang/rust.git
59 lines
1.8 KiB
Plaintext
59 lines
1.8 KiB
Plaintext
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`.
|