]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-move-out-of-static-item.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / borrowck-move-out-of-static-item.rs
1 // Ensure that moves out of static items is forbidden
2
3 struct Foo {
4     foo: isize,
5 }
6
7 static BAR: Foo = Foo { foo: 5 };
8
9
10 fn test(f: Foo) {
11     let _f = Foo{foo: 4, ..f};
12 }
13
14 fn main() {
15     test(BAR); //~ ERROR cannot move out of static item `BAR` [E0507]
16 }