Move array-slice-vec-related tests
This commit is contained in:
parent
6871d43d4c
commit
50454cf64b
29 changed files with 17 additions and 17 deletions
|
@ -1,12 +1,8 @@
|
|||
// run-pass
|
||||
#![allow(dead_code)]
|
||||
#![allow(stable_features)]
|
||||
|
||||
#![feature(const_indexing)]
|
||||
const A: [i32; 0] = [];
|
||||
const B: i32 = A[1];
|
||||
//~^ index out of bounds: the length is 0 but the index is 1
|
||||
//~| ERROR any use of this value will cause an error
|
||||
|
||||
fn main() {
|
||||
const ARR: [i32; 6] = [42, 43, 44, 45, 46, 47];
|
||||
const IDX: usize = 3;
|
||||
const VAL: i32 = ARR[IDX];
|
||||
const BLUB: [i32; (ARR[0] - 41) as usize] = [5];
|
||||
let _ = B;
|
||||
}
|
||||
|
|
12
src/test/ui/array-slice-vec/array_const_index-2.rs
Normal file
12
src/test/ui/array-slice-vec/array_const_index-2.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
// run-pass
|
||||
#![allow(dead_code)]
|
||||
#![allow(stable_features)]
|
||||
|
||||
#![feature(const_indexing)]
|
||||
|
||||
fn main() {
|
||||
const ARR: [i32; 6] = [42, 43, 44, 45, 46, 47];
|
||||
const IDX: usize = 3;
|
||||
const VAL: i32 = ARR[IDX];
|
||||
const BLUB: [i32; (ARR[0] - 41) as usize] = [5];
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
const A: [i32; 0] = [];
|
||||
const B: i32 = A[1];
|
||||
//~^ index out of bounds: the length is 0 but the index is 1
|
||||
//~| ERROR any use of this value will cause an error
|
||||
|
||||
fn main() {
|
||||
let _ = B;
|
||||
}
|
Loading…
Reference in a new issue