Skip to content

Commit

Permalink
Rollup merge of rust-lang#55090 - pnkfelix:issue-54597-regression-tes…
Browse files Browse the repository at this point in the history
…t, r=estebank

regression test for move out of borrow via pattern

regression test for issue rust-lang#54597.

(We may have other tests that cover this, but I couldn't immediately find them associated with the PR that originally fixed the ICE here.)
  • Loading branch information
kennytm committed Oct 18, 2018
2 parents 955016c + 481ad0e commit bea91dc
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#![feature(nll)]

#![allow(dead_code)]

#[derive(Debug)]
struct Value;
impl Value {
fn as_array(&self) -> Option<&Vec<Value>> {
None
}
}

fn foo(val: Value) {
let _reviewers_original: Vec<Value> = match val.as_array() {
Some(array) => {
*array
}
None => vec![]
};
}

fn main() { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error[E0507]: cannot move out of borrowed content
--> $DIR/issue-54597-reject-move-out-of-borrow-via-pat.rs:16:13
|
LL | *array
| ^^^^^^
| |
| cannot move out of borrowed content
| help: consider removing the `*`: `array`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0507`.

0 comments on commit bea91dc

Please sign in to comment.