W3cubDocs

/Rust

Error code E0797

Struct update syntax was used without a base expression.

Erroneous code example:

#![allow(unused)]
fn main() {
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.

#![allow(unused)]
fn main() {
struct Foo {
    fizz: u8,
    buzz: u8
}

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

© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/error_codes/E0797.html