rust/tests/ui/static/static-items-cant-move.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
263 B
Rust
Raw Normal View History

2014-01-19 08:10:34 -06:00
// Verifies that static items can't be moved
struct B;
2014-01-19 08:10:34 -06:00
struct Foo {
foo: isize,
b: B,
2014-01-19 08:10:34 -06:00
}
static BAR: Foo = Foo { foo: 5, b: B };
2014-01-19 08:10:34 -06:00
fn test(f: Foo) {
let _f = Foo{foo: 4, ..f};
}
fn main() {
test(BAR); //~ ERROR cannot move out of static item
2014-01-19 08:10:34 -06:00
}