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
```
This commit is contained in:
Guillaume Gomez 2017-11-14 16:52:12 +01:00 committed by GitHub
commit 01e979f7b1
4 changed files with 14 additions and 12 deletions

View file

@ -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]
}