Converted moves-based-on-type-tuple test and added MIR borrowck comparison.

This commit is contained in:
David Wood 2017-12-21 18:56:48 +00:00
parent 81622c6b02
commit c428b7d9c1
No known key found for this signature in database
GPG Key ID: 01760B4F9F53F154
2 changed files with 28 additions and 1 deletions

View File

@ -10,9 +10,14 @@
#![feature(box_syntax)]
// compile-flags: -Z emit-end-regions -Z borrowck=compare
fn dup(x: Box<isize>) -> Box<(Box<isize>,Box<isize>)> {
box (x, x) //~ ERROR use of moved value
box (x, x)
//~^ use of moved value: `x` (Ast) [E0382]
//~| use of moved value: `x` (Mir) [E0382]
}
fn main() {
dup(box 3);
}

View File

@ -0,0 +1,22 @@
error[E0382]: use of moved value: `x` (Ast)
--> $DIR/moves-based-on-type-tuple.rs:16:13
|
16 | box (x, x)
| - ^ value used here after move
| |
| value moved here
|
= note: move occurs because `x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `x` (Mir)
--> $DIR/moves-based-on-type-tuple.rs:16:13
|
16 | box (x, x)
| - ^ value used here after move
| |
| value moved here
|
= note: move occurs because `x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
error: aborting due to 2 previous errors