]> git.proxmox.com Git - rustc.git/blame - src/test/ui/pattern/bindings-after-at/borrowck-move-and-move.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / pattern / bindings-after-at / borrowck-move-and-move.rs
CommitLineData
dfeec247
XL
1// Test that moving on both sides of an `@` pattern is not allowed.
2
dfeec247
XL
3fn main() {
4 struct U; // Not copy!
5
6 // Prevent promotion:
74b04a01
XL
7 fn u() -> U {
8 U
9 }
dfeec247 10
74b04a01 11 let a @ b = U; //~ ERROR use of moved value
dfeec247 12
29967ef6 13 let a @ (b, c) = (U, U); //~ ERROR use of partially moved value
dfeec247 14
29967ef6 15 let a @ (b, c) = (u(), u()); //~ ERROR use of partially moved value
dfeec247
XL
16
17 match Ok(U) {
74b04a01
XL
18 a @ Ok(b) | a @ Err(b) => {} //~ ERROR use of moved value
19 //~^ ERROR use of moved value
dfeec247
XL
20 }
21
74b04a01 22 fn fun(a @ b: U) {} //~ ERROR use of moved value
dfeec247
XL
23
24 match [u(), u(), u(), u()] {
29967ef6 25 xs @ [a, .., b] => {} //~ ERROR use of partially moved value
dfeec247
XL
26 }
27
28 match [u(), u(), u(), u()] {
29967ef6 29 xs @ [_, ys @ .., _] => {} //~ ERROR use of partially moved value
dfeec247
XL
30 }
31}