]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.rs
1 // Ensures the independence of each side in `binding @ subpat`
2 // determine their binding modes independently of each other.
4 // That is, `binding` does not influence `subpat`.
5 // This is important because we might want to allow `p1 @ p2`,
6 // where both `p1` and `p2` are syntactically unrestricted patterns.
7 // If `binding` is allowed to influence `subpat`,
8 // this would create problems for the generalization aforementioned.
10 #![feature(bindings_after_at)]
11 #![feature(move_ref_pattern)]
16 fn f1(a @ b
: &NotCopy
) { // OK
19 fn f2(ref a @ b
: &NotCopy
) {
20 let _
: &&NotCopy
= a
; // Ok
23 let a @ b
= &NotCopy
; // OK
25 let ref a @ b
= &NotCopy
; // OK
28 let ref a @ b
= NotCopy
; //~ ERROR cannot move out of value because it is borrowed
31 let ref mut a @ b
= NotCopy
; //~ ERROR cannot move out of value because it is borrowed
32 //~^ ERROR cannot move out of `_` because it is borrowed
36 Ok(ref a @ b
) | Err(b @
ref a
) => {
37 //~^ ERROR cannot move out of value because it is borrowed
38 //~| ERROR borrow of moved value
45 //~^ ERROR cannot move out of value because it is borrowed