about summary refs log tree commit diff
path: root/compiler/rustc_error_codes/src/error_codes/E0797.md
blob: 8a912307264e3d840916f14cf1a3919f344eccde (plain)
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
Struct update syntax was used without a base expression.

Erroneous code example:

```compile_fail,E0797
struct Foo {
    fizz: u8,
    buzz: u8
}

let f1 = Foo { fizz: 10, buzz: 1};
let f2 = Foo { fizz: 10, .. }; // error
```

Using struct update syntax requires a 'base expression'.
This will be used to fill remaining fields.

```
struct Foo {
    fizz: u8,
    buzz: u8
}

let f1 = Foo { fizz: 10, buzz: 1};
let f2 = Foo { fizz: 10, ..f1 };
```