forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#55090 - pnkfelix:issue-54597-regression-tes…
…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
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { } |
12 changes: 12 additions & 0 deletions
12
src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`. |