about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2017-11-14 16:52:12 +0100
committerGitHub <noreply@github.com>2017-11-14 16:52:12 +0100
commit01e979f7b1409a14df6535ca736e65331f3f37f6 (patch)
tree114fc719d32ad2a2a61302a447894f7a01229648 /src/test/compile-fail
parent529bb320f7d1c3a049fe5fe8d2542da4fb394dce (diff)
parenta6824f18b886d3ca846916fb9bdc188453d2ebe9 (diff)
downloadrust-01e979f7b1409a14df6535ca736e65331f3f37f6.tar.gz
rust-01e979f7b1409a14df6535ca736e65331f3f37f6.zip
Rollup merge of #45967 - matthewjasper:array-move-types, r=arielb1
MIR-borrowck: don't ICE for cannot move from array error

Closes #45694
compile-fail test E0508 now gives
```text
error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array (Ast)
  --> .\src\test\compile-fail\E0508.rs:18:18
   |
18 |     let _value = array[0];  //[ast]~ ERROR E0508
   |                  ^^^^^^^^
   |                  |
   |                  cannot move out of here
   |                  help: consider using a reference instead: `&array[0]`

error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array (Mir)
  --> .\src\test\compile-fail\E0508.rs:18:18
   |
18 |     let _value = array[0];  //[ast]~ ERROR E0508
   |                  ^^^^^^^^ cannot move out of here

error: aborting due to 2 previous errors
```
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/E0508.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/test/compile-fail/E0508.rs b/src/test/compile-fail/E0508.rs
index a72c29cc3a5..d75f92580cc 100644
--- a/src/test/compile-fail/E0508.rs
+++ b/src/test/compile-fail/E0508.rs
@@ -8,9 +8,14 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// revisions: ast mir
+//[mir]compile-flags: -Zborrowck-mir
+
 struct NonCopy;
 
 fn main() {
     let array = [NonCopy; 1];
-    let _value = array[0]; //~ ERROR E0508
+    let _value = array[0];  //[ast]~ ERROR E0508
+                            //[mir]~^ ERROR (Ast) [E0508]
+                            //[mir]~| ERROR (Mir) [E0508]
 }