]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-move-out-of-static-item.rs
Auto merge of #56838 - Aaron1011:fix/rustdoc-infer-unify, r=nikomatsakis
[rust.git] / src / test / ui / borrowck / borrowck-move-out-of-static-item.rs
1 // revisions: ast mir
2 //[mir]compile-flags: -Z borrowck=mir
3
4 // Ensure that moves out of static items is forbidden
5
6 struct Foo {
7     foo: isize,
8 }
9
10 static BAR: Foo = Foo { foo: 5 };
11
12
13 fn test(f: Foo) {
14     let _f = Foo{foo: 4, ..f};
15 }
16
17 fn main() {
18     test(BAR); //[ast]~ ERROR cannot move out of static item [E0507]
19                //[mir]~^ ERROR [E0507]
20 }