fake a base to suppress later extra error message
This commit is contained in:
parent
1e25882944
commit
4b77e730b5
4 changed files with 36 additions and 42 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#![allow(dead_code)]
|
||||
|
||||
#[derive(Default)]
|
||||
struct V3 {
|
||||
x: f32,
|
||||
y: f32,
|
||||
|
|
@ -9,14 +10,16 @@ struct V3 {
|
|||
fn pz(v: V3) {
|
||||
let _ = V3 { z: 0.0, ...v};
|
||||
//~^ ERROR expected `..`
|
||||
//~| ERROR missing fields `x` and `y` in initializer of `V3`
|
||||
|
||||
let _ = V3 { z: 0.0, ...Default::default() };
|
||||
//~^ ERROR expected `..`
|
||||
|
||||
let _ = V3 { z: 0.0, ... };
|
||||
//~^ expected identifier
|
||||
//~| ERROR missing fields `x` and `y` in initializer of `V3`
|
||||
|
||||
let _ = V3 { z: 0.0, ...Default::default() };
|
||||
//~^ ERROR expected `..`
|
||||
//~| ERROR missing fields `x` and `y` in initializer of `V3`
|
||||
let V3 { z: val, ... } = v;
|
||||
//~^ ERROR expected field pattern
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: expected `..`, found `...`
|
||||
--> $DIR/issue-102806.rs:10:26
|
||||
--> $DIR/issue-102806.rs:11:26
|
||||
|
|
||||
LL | let _ = V3 { z: 0.0, ...v};
|
||||
| ^^^
|
||||
|
|
@ -9,16 +9,8 @@ help: use `..` to fill in the rest of the fields
|
|||
LL | let _ = V3 { z: 0.0, ..v};
|
||||
| ~~
|
||||
|
||||
error: expected identifier, found `...`
|
||||
--> $DIR/issue-102806.rs:13:26
|
||||
|
|
||||
LL | let _ = V3 { z: 0.0, ... };
|
||||
| -- ^^^ expected identifier
|
||||
| |
|
||||
| while parsing this struct
|
||||
|
||||
error: expected `..`, found `...`
|
||||
--> $DIR/issue-102806.rs:17:26
|
||||
--> $DIR/issue-102806.rs:14:26
|
||||
|
|
||||
LL | let _ = V3 { z: 0.0, ...Default::default() };
|
||||
| ^^^
|
||||
|
|
@ -28,24 +20,26 @@ help: use `..` to fill in the rest of the fields
|
|||
LL | let _ = V3 { z: 0.0, ..Default::default() };
|
||||
| ~~
|
||||
|
||||
error[E0063]: missing fields `x` and `y` in initializer of `V3`
|
||||
--> $DIR/issue-102806.rs:10:13
|
||||
|
|
||||
LL | let _ = V3 { z: 0.0, ...v};
|
||||
| ^^ missing `x` and `y`
|
||||
|
||||
error[E0063]: missing fields `x` and `y` in initializer of `V3`
|
||||
--> $DIR/issue-102806.rs:13:13
|
||||
error: expected identifier, found `...`
|
||||
--> $DIR/issue-102806.rs:17:26
|
||||
|
|
||||
LL | let _ = V3 { z: 0.0, ... };
|
||||
| ^^ missing `x` and `y`
|
||||
| -- ^^^ expected identifier
|
||||
| |
|
||||
| while parsing this struct
|
||||
|
||||
error: expected field pattern, found `...`
|
||||
--> $DIR/issue-102806.rs:21:22
|
||||
|
|
||||
LL | let V3 { z: val, ... } = v;
|
||||
| ^^^ help: to omit remaining fields, use one fewer `.`: `..`
|
||||
|
||||
error[E0063]: missing fields `x` and `y` in initializer of `V3`
|
||||
--> $DIR/issue-102806.rs:17:13
|
||||
|
|
||||
LL | let _ = V3 { z: 0.0, ...Default::default() };
|
||||
LL | let _ = V3 { z: 0.0, ... };
|
||||
| ^^ missing `x` and `y`
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0063`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue