diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs | 22 | ||||
| -rw-r--r-- | src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr | 12 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs new file mode 100644 index 00000000000..0749900986d --- /dev/null +++ b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs @@ -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() { } diff --git a/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr new file mode 100644 index 00000000000..6a12016b2a5 --- /dev/null +++ b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr @@ -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`. |
