Skip to content

Commit cfd11fb

Browse files
committed
Update compile-fail tests
1 parent b3b6071 commit cfd11fb

9 files changed

+24
-89
lines changed

src/test/compile-fail/array_const_index-0.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
const A: &'static [i32] = &[];
1212
const B: i32 = (&A)[1];
1313
//~^ ERROR constant evaluation error
14-
//~| ERROR E0080
1514
//~| index out of bounds: the len is 0 but the index is 1
1615

1716
fn main() {

src/test/compile-fail/array_const_index-1.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
const A: [i32; 0] = [];
1212
const B: i32 = A[1];
1313
//~^ ERROR constant evaluation error
14-
//~| ERROR E0080
1514
//~| index out of bounds: the len is 0 but the index is 1
1615

1716
fn main() {

src/test/compile-fail/const-err-early.rs

-5
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,11 @@
1313
pub const A: i8 = -std::i8::MIN; //~ ERROR E0080
1414
//~| ERROR const_err
1515
//~| ERROR const_err
16-
//~| ERROR E0080
1716
pub const B: u8 = 200u8 + 200u8; //~ ERROR E0080
18-
//~| ERROR E0080
1917
pub const C: u8 = 200u8 * 4; //~ ERROR E0080
20-
//~| ERROR E0080
2118
pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR E0080
22-
//~| ERROR E0080
2319
pub const E: u8 = [5u8][1];
2420
//~^ ERROR E0080
25-
//~| ERROR E0080
2621

2722
fn main() {
2823
let _a = A;

src/test/compile-fail/const-err-multi.rs

-7
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,12 @@ pub const A: i8 = -std::i8::MIN;
1414
//~^ ERROR E0080
1515
//~| ERROR const_err
1616
//~| ERROR const_err
17-
//~| ERROR constant evaluation error
18-
//~| ERROR constant evaluation error
19-
//~| ERROR constant evaluation error
20-
//~| ERROR E0080
2117
pub const B: i8 = A;
2218
//~^ ERROR E0080
23-
//~| ERROR E0080
2419
pub const C: u8 = A as u8;
2520
//~^ ERROR E0080
26-
//~| ERROR E0080
2721
pub const D: i8 = 50 - A;
2822
//~^ ERROR E0080
29-
//~| ERROR E0080
3023

3124
fn main() {
3225
let _ = (A, B, C, D);

src/test/compile-fail/const-err.rs

-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ fn black_box<T>(_: T) {
2323
// Make sure that the two uses get two errors.
2424
const FOO: u8 = [5u8][1];
2525
//~^ ERROR constant evaluation error
26-
//~| ERROR constant evaluation error
2726
//~| index out of bounds: the len is 1 but the index is 1
28-
//~| ERROR E0080
2927

3028
fn main() {
3129
black_box((FOO, FOO));

src/test/compile-fail/const-eval-overflow2.rs

+8-24
Original file line numberDiff line numberDiff line change
@@ -22,65 +22,49 @@ use std::{i8, i16, i32, i64, isize};
2222
use std::{u8, u16, u32, u64, usize};
2323

2424
const VALS_I8: (i8,) =
25-
//~^ ERROR constant evaluation error
26-
//~| ERROR constant evaluation error
27-
//~| attempt to subtract with overflow
2825
(
2926
i8::MIN - 1,
27+
//~^ ERROR constant evaluation error
3028
);
3129

3230
const VALS_I16: (i16,) =
33-
//~^ ERROR constant evaluation error
34-
//~| ERROR constant evaluation error
35-
//~| attempt to subtract with overflow
3631
(
3732
i16::MIN - 1,
33+
//~^ ERROR constant evaluation error
3834
);
3935

4036
const VALS_I32: (i32,) =
41-
//~^ ERROR constant evaluation error
42-
//~| ERROR constant evaluation error
43-
//~| attempt to subtract with overflow
4437
(
4538
i32::MIN - 1,
39+
//~^ ERROR constant evaluation error
4640
);
4741

4842
const VALS_I64: (i64,) =
49-
//~^ ERROR constant evaluation error
50-
//~| ERROR constant evaluation error
51-
//~| attempt to subtract with overflow
5243
(
5344
i64::MIN - 1,
45+
//~^ ERROR constant evaluation error
5446
);
5547

5648
const VALS_U8: (u8,) =
57-
//~^ ERROR constant evaluation error
58-
//~| ERROR constant evaluation error
59-
//~| attempt to subtract with overflow
6049
(
6150
u8::MIN - 1,
51+
//~^ ERROR constant evaluation error
6252
);
6353

6454
const VALS_U16: (u16,) = (
65-
//~^ ERROR constant evaluation error
66-
//~| ERROR constant evaluation error
67-
//~| attempt to subtract with overflow
6855
u16::MIN - 1,
56+
//~^ ERROR constant evaluation error
6957
);
7058

7159
const VALS_U32: (u32,) = (
72-
//~^ ERROR constant evaluation error
73-
//~| ERROR constant evaluation error
74-
//~| attempt to subtract with overflow
7560
u32::MIN - 1,
61+
//~^ ERROR constant evaluation error
7662
);
7763

7864
const VALS_U64: (u64,) =
79-
//~^ ERROR constant evaluation error
80-
//~| ERROR constant evaluation error
81-
//~| attempt to subtract with overflow
8265
(
8366
u64::MIN - 1,
67+
//~^ ERROR constant evaluation error
8468
);
8569

8670
fn main() {

src/test/compile-fail/const-eval-overflow2b.rs

+8-24
Original file line numberDiff line numberDiff line change
@@ -22,65 +22,49 @@ use std::{i8, i16, i32, i64, isize};
2222
use std::{u8, u16, u32, u64, usize};
2323

2424
const VALS_I8: (i8,) =
25-
//~^ ERROR constant evaluation error
26-
//~| ERROR constant evaluation error
27-
//~| attempt to add with overflow
2825
(
2926
i8::MAX + 1,
27+
//~^ ERROR constant evaluation error
3028
);
3129

3230
const VALS_I16: (i16,) =
33-
//~^ ERROR constant evaluation error
34-
//~| ERROR constant evaluation error
35-
//~| attempt to add with overflow
3631
(
3732
i16::MAX + 1,
33+
//~^ ERROR constant evaluation error
3834
);
3935

4036
const VALS_I32: (i32,) =
41-
//~^ ERROR constant evaluation error
42-
//~| ERROR constant evaluation error
43-
//~| attempt to add with overflow
4437
(
4538
i32::MAX + 1,
39+
//~^ ERROR constant evaluation error
4640
);
4741

4842
const VALS_I64: (i64,) =
49-
//~^ ERROR constant evaluation error
50-
//~| ERROR constant evaluation error
51-
//~| attempt to add with overflow
5243
(
5344
i64::MAX + 1,
45+
//~^ ERROR constant evaluation error
5446
);
5547

5648
const VALS_U8: (u8,) =
57-
//~^ ERROR constant evaluation error
58-
//~| ERROR constant evaluation error
59-
//~| attempt to add with overflow
6049
(
6150
u8::MAX + 1,
51+
//~^ ERROR constant evaluation error
6252
);
6353

6454
const VALS_U16: (u16,) = (
65-
//~^ ERROR constant evaluation error
66-
//~| ERROR constant evaluation error
67-
//~| attempt to add with overflow
6855
u16::MAX + 1,
56+
//~^ ERROR constant evaluation error
6957
);
7058

7159
const VALS_U32: (u32,) = (
72-
//~^ ERROR constant evaluation error
73-
//~| ERROR constant evaluation error
74-
//~| attempt to add with overflow
7560
u32::MAX + 1,
61+
//~^ ERROR constant evaluation error
7662
);
7763

7864
const VALS_U64: (u64,) =
79-
//~^ ERROR constant evaluation error
80-
//~| ERROR constant evaluation error
81-
//~| attempt to add with overflow
8265
(
8366
u64::MAX + 1,
67+
//~^ ERROR constant evaluation error
8468
);
8569

8670
fn main() {

src/test/compile-fail/const-eval-overflow2c.rs

+8-24
Original file line numberDiff line numberDiff line change
@@ -22,65 +22,49 @@ use std::{i8, i16, i32, i64, isize};
2222
use std::{u8, u16, u32, u64, usize};
2323

2424
const VALS_I8: (i8,) =
25-
//~^ ERROR constant evaluation error
26-
//~| ERROR constant evaluation error
27-
//~| attempt to multiply with overflow
2825
(
2926
i8::MIN * 2,
27+
//~^ ERROR constant evaluation error
3028
);
3129

3230
const VALS_I16: (i16,) =
33-
//~^ ERROR constant evaluation error
34-
//~| ERROR constant evaluation error
35-
//~| attempt to multiply with overflow
3631
(
3732
i16::MIN * 2,
33+
//~^ ERROR constant evaluation error
3834
);
3935

4036
const VALS_I32: (i32,) =
41-
//~^ ERROR constant evaluation error
42-
//~| ERROR constant evaluation error
43-
//~| attempt to multiply with overflow
4437
(
4538
i32::MIN * 2,
39+
//~^ ERROR constant evaluation error
4640
);
4741

4842
const VALS_I64: (i64,) =
49-
//~^ ERROR constant evaluation error
50-
//~| ERROR constant evaluation error
51-
//~| attempt to multiply with overflow
5243
(
5344
i64::MIN * 2,
45+
//~^ ERROR constant evaluation error
5446
);
5547

5648
const VALS_U8: (u8,) =
57-
//~^ ERROR constant evaluation error
58-
//~| ERROR constant evaluation error
59-
//~| attempt to multiply with overflow
6049
(
6150
u8::MAX * 2,
51+
//~^ ERROR constant evaluation error
6252
);
6353

6454
const VALS_U16: (u16,) = (
65-
//~^ ERROR constant evaluation error
66-
//~| ERROR constant evaluation error
67-
//~| attempt to multiply with overflow
6855
u16::MAX * 2,
56+
//~^ ERROR constant evaluation error
6957
);
7058

7159
const VALS_U32: (u32,) = (
72-
//~^ ERROR constant evaluation error
73-
//~| ERROR constant evaluation error
74-
//~| attempt to multiply with overflow
7560
u32::MAX * 2,
61+
//~^ ERROR constant evaluation error
7662
);
7763

7864
const VALS_U64: (u64,) =
79-
//~^ ERROR constant evaluation error
80-
//~| ERROR constant evaluation error
81-
//~| attempt to multiply with overflow
8265
(
8366
u64::MAX * 2,
67+
//~^ ERROR constant evaluation error
8468
);
8569

8670
fn main() {

src/test/compile-fail/const-slice-oob.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
const FOO: &'static[u32] = &[1, 2, 3];
1414
const BAR: u32 = FOO[5];
1515
//~^ ERROR constant evaluation error [E0080]
16-
//~| ERROR constant evaluation error [E0080]
1716
//~| index out of bounds: the len is 3 but the index is 5
1817

1918
fn main() {

0 commit comments

Comments
 (0)