mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 22:18:23 +03:00
f5d3b158b9
This prevents spurious errors when a field is intended to be present
but a preceding syntax error caused it not to be parsed. For example,
StructName { foo: 1 bar: 2 }
will not successfully parse a field `bar`, and we will report the syntax
error but not the missing field.
25 lines
403 B
Rust
25 lines
403 B
Rust
#![allow(dead_code)]
|
|
|
|
#[derive(Default)]
|
|
struct V3 {
|
|
x: f32,
|
|
y: f32,
|
|
z: f32,
|
|
}
|
|
|
|
fn pz(v: V3) {
|
|
let _ = V3 { z: 0.0, ...v};
|
|
//~^ ERROR expected `..`
|
|
|
|
let _ = V3 { z: 0.0, ...Default::default() };
|
|
//~^ ERROR expected `..`
|
|
|
|
let _ = V3 { z: 0.0, ... };
|
|
//~^ ERROR expected identifier
|
|
|
|
let V3 { z: val, ... } = v;
|
|
//~^ ERROR expected field pattern
|
|
}
|
|
|
|
fn main() {}
|