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 14:10:34 +00:00
// Verifies that static items can't be moved
struct B;
2014-01-19 14:10:34 +00:00
struct Foo {
foo: isize,
b: B,
2014-01-19 14:10:34 +00:00
}
static BAR: Foo = Foo { foo: 5, b: B };
2014-01-19 14:10:34 +00: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 14:10:34 +00:00
}