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:
commit
f8d830b4de
58 changed files with 2841 additions and 857 deletions
|
|
@ -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!()
|
||||
}
|
||||
}
|
||||
|
|
@ -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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue