Auto merge of #68376 - Centril:move-ref-patterns, r=matthewjasper

Initial implementation of `#![feature(move_ref_pattern)]`

Following up on #45600, under the gate `#![feature(move_ref_pattern)]`, `(ref x, mut y)` is allowed subject to restrictions necessary for soundness. The match checking implementation and tests for `#![feature(bindings_after_at)]` is also adjusted as necessary.

Closes #45600.
Tracking issue: #68354.

r? @matthewjasper
This commit is contained in:
bors 2020-02-09 04:01:28 +00:00
commit f8d830b4de
58 changed files with 2841 additions and 857 deletions

View file

@ -1,9 +0,0 @@
fn main() {
struct X { x: (), }
let x = Some((X { x: () }, X { x: () }));
match x {
Some((y, ref z)) => {},
//~^ ERROR E0009
None => panic!()
}
}

View file

@ -1,11 +0,0 @@
error[E0009]: cannot bind by-move and by-ref in the same pattern
--> $DIR/E0009.rs:5:15
|
LL | Some((y, ref z)) => {},
| ^ ----- by-ref pattern here
| |
| by-move pattern here
error: aborting due to previous error
For more information about this error, try `rustc --explain E0009`.