Skip to content

Commit d0e05f0

Browse files
committed
update tests
1 parent 0078e54 commit d0e05f0

40 files changed

+204
-285
lines changed

src/test/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir

+16-16
Original file line numberDiff line numberDiff line change
@@ -21,44 +21,44 @@ fn main() -> () {
2121
}
2222

2323
alloc1 (static: FOO, size: 16, align: 8) {
24-
╾───────alloc22───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
24+
╾───────alloc28───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
2525
}
2626

27-
alloc22 (size: 72, align: 8) {
28-
0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc9────────╼ │ ....░░░░╾──────╼
27+
alloc28 (size: 72, align: 8) {
28+
0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc13───────╼ │ ....░░░░╾──────╼
2929
0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ │ ............░░░░
30-
0x20 │ ╾───────alloc14───────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
31-
0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc20───────╼ │ ....*...╾──────╼
30+
0x20 │ ╾───────alloc18───────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
31+
0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc26───────╼ │ ....*...╾──────╼
3232
0x40 │ 03 00 00 00 00 00 00 00 │ ........
3333
}
3434

35-
alloc9 (size: 0, align: 8) {}
35+
alloc13 (size: 0, align: 8) {}
3636

37-
alloc14 (size: 16, align: 8) {
38-
╾───────alloc12───────╼ ╾───────alloc13───────╼ │ ╾──────╼╾──────╼
37+
alloc18 (size: 16, align: 8) {
38+
╾───────alloc16───────╼ ╾───────alloc17───────╼ │ ╾──────╼╾──────╼
3939
}
4040

41-
alloc12 (size: 1, align: 1) {
41+
alloc16 (size: 1, align: 1) {
4242
05 │ .
4343
}
4444

45-
alloc13 (size: 1, align: 1) {
45+
alloc17 (size: 1, align: 1) {
4646
06 │ .
4747
}
4848

49-
alloc20 (size: 24, align: 8) {
50-
0x00 │ ╾─────alloc17+0x3─────╼ ╾───────alloc18───────╼ │ ╾──────╼╾──────╼
51-
0x10 │ ╾─────alloc19+0x2─────╼ │ ╾──────╼
49+
alloc26 (size: 24, align: 8) {
50+
0x00 │ ╾─────alloc22+0x3─────╼ ╾───────alloc23───────╼ │ ╾──────╼╾──────╼
51+
0x10 │ ╾─────alloc25+0x2─────╼ │ ╾──────╼
5252
}
5353

54-
alloc17 (size: 4, align: 1) {
54+
alloc22 (size: 4, align: 1) {
5555
2a 45 15 6f │ *E.o
5656
}
5757

58-
alloc18 (size: 1, align: 1) {
58+
alloc23 (size: 1, align: 1) {
5959
2a │ *
6060
}
6161

62-
alloc19 (size: 4, align: 1) {
62+
alloc25 (size: 4, align: 1) {
6363
2a 45 15 6f │ *E.o
6464
}

src/test/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
- _2 = transmute::<&str, &[u8]>(move _8) -> bb14; // scope 2 at $SRC_DIR/core/src/str/mod.rs:LL:COL
2727
+ _2 = transmute::<&str, &[u8]>(move _8) -> bb12; // scope 2 at $SRC_DIR/core/src/str/mod.rs:LL:COL
2828
// mir::Constant
29-
// + span: $DIR/deduplicate_blocks.rs:3:11: 3:23
29+
// + span: $SRC_DIR/core/src/str/mod.rs:LL:COL
3030
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&str) -> &[u8] {transmute::<&str, &[u8]>}, val: Value(Scalar(<ZST>)) }
3131
}
3232

src/test/mir-opt/inline/inline_diverging.g.Inline.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
// mir::Constant
4040
- // + span: $DIR/inline-diverging.rs:16:9: 16:14
4141
- // + literal: Const { ty: fn() -> ! {panic}, val: Value(Scalar(<ZST>)) }
42-
+ // + span: $DIR/inline-diverging.rs:16:9: 16:16
42+
+ // + span: $SRC_DIR/std/src/panic.rs:LL:COL
4343
+ // + literal: Const { ty: fn(&str) -> ! {begin_panic::<&str>}, val: Value(Scalar(<ZST>)) }
4444
+ // mir::Constant
4545
+ // + span: $SRC_DIR/std/src/panic.rs:LL:COL

src/test/mir-opt/inline/inline_into_box_place.main.Inline.64bit.diff

+3-6
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@
3434
- (*_5) = Vec::<u32>::new() -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
3535
+ StorageLive(_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
3636
+ _7 = &mut (*_5); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
37-
+ ((*_7).0: alloc::raw_vec::RawVec<u32>) = const alloc::raw_vec::RawVec::<u32>::NEW; // scope 3 at $DIR/inline-into-box-place.rs:8:33: 8:43
38-
+ // ty::Const
39-
+ // + ty: alloc::raw_vec::RawVec<u32>
40-
+ // + val: Unevaluated(alloc::raw_vec::RawVec::<T>::NEW, [u32], None)
37+
+ ((*_7).0: alloc::raw_vec::RawVec<u32>) = const alloc::raw_vec::RawVec::<u32> { ptr: Unique::<u32> { pointer: {0x4 as *const u32}, _marker: PhantomData::<u32> }, cap: 0_usize, alloc: std::alloc::Global }; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
4138
// mir::Constant
4239
- // + span: $DIR/inline-into-box-place.rs:8:33: 8:41
4340
- // + user_ty: UserType(1)
@@ -47,8 +44,8 @@
4744
- bb2: {
4845
+ // + span: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
4946
+ // + user_ty: UserType(0)
50-
+ // + literal: Const { ty: alloc::raw_vec::RawVec<u32>, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(5:77 ~ alloc[25db]::raw_vec::{impl#0}::NEW), const_param_did: None }, substs: [u32], promoted: None }) }
51-
+ ((*_7).1: usize) = const 0_usize; // scope 3 at $DIR/inline-into-box-place.rs:8:33: 8:43
47+
+ // + literal: Const { ty: alloc::raw_vec::RawVec<u32>, val: Value(ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [65535], len: Size { raw: 16 } }, align: Align { pow2: 3 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }) }
48+
+ ((*_7).1: usize) = const 0_usize; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
5249
+ StorageDead(_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
5350
_1 = move _5; // scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
5451
StorageDead(_5); // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43

src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn num_to_digit(_1: char) -> u32 {
3838
_8 = _2; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
3939
_7 = char::methods::<impl char>::to_digit(move _8, const 8_u32) -> bb5; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
4040
// mir::Constant
41-
// + span: $DIR/issue-59352.rs:14:8: 14:23
41+
// + span: $SRC_DIR/core/src/char/methods.rs:LL:COL
4242
// + literal: Const { ty: fn(char, u32) -> Option<u32> {char::methods::<impl char>::to_digit}, val: Value(Scalar(<ZST>)) }
4343
}
4444

src/test/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
_14 = &mut (*_8); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
5959
_7 = <std::ops::Range<i32> as iter::range::RangeIteratorImpl>::spec_next(move _14) -> bb4; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
6060
// mir::Constant
61-
// + span: $DIR/remove_storage_markers.rs:8:14: 8:19
61+
// + span: $SRC_DIR/core/src/iter/range.rs:LL:COL
6262
// + literal: Const { ty: for<'r> fn(&'r mut std::ops::Range<i32>) -> Option<<std::ops::Range<i32> as iter::range::RangeIteratorImpl>::Item> {<std::ops::Range<i32> as iter::range::RangeIteratorImpl>::spec_next}, val: Value(Scalar(<ZST>)) }
6363
}
6464

src/test/ui/associated-consts/defaults-cyclic-fail.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// Cyclic assoc. const defaults don't error unless *used*
55
trait Tr {
66
const A: u8 = Self::B;
7-
//~^ ERROR cycle detected when const-evaluating + checking `Tr::A`
87

98
const B: u8 = Self::A;
109
}

src/test/ui/associated-consts/defaults-cyclic-fail.stderr

+25-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,37 @@
1-
error[E0391]: cycle detected when const-evaluating + checking `Tr::A`
2-
--> $DIR/defaults-cyclic-fail.rs:5:5
1+
error[E0391]: cycle detected when normalizing `<() as Tr>::A`
2+
|
3+
note: ...which requires simplifying constant for the type system `Tr::A`...
4+
--> $DIR/defaults-cyclic-fail.rs:6:5
5+
|
6+
LL | const A: u8 = Self::B;
7+
| ^^^^^^^^^^^^^^^^^^^^^^
8+
note: ...which requires simplifying constant for the type system `Tr::A`...
9+
--> $DIR/defaults-cyclic-fail.rs:6:5
10+
|
11+
LL | const A: u8 = Self::B;
12+
| ^^^^^^^^^^^^^^^^^^^^^^
13+
note: ...which requires const-evaluating + checking `Tr::A`...
14+
--> $DIR/defaults-cyclic-fail.rs:6:5
315
|
416
LL | const A: u8 = Self::B;
517
| ^^^^^^^^^^^^^^^^^^^^^^
18+
= note: ...which requires normalizing `<() as Tr>::B`...
19+
note: ...which requires simplifying constant for the type system `Tr::B`...
20+
--> $DIR/defaults-cyclic-fail.rs:8:5
621
|
22+
LL | const B: u8 = Self::A;
23+
| ^^^^^^^^^^^^^^^^^^^^^^
24+
note: ...which requires simplifying constant for the type system `Tr::B`...
25+
--> $DIR/defaults-cyclic-fail.rs:8:5
26+
|
27+
LL | const B: u8 = Self::A;
28+
| ^^^^^^^^^^^^^^^^^^^^^^
729
note: ...which requires const-evaluating + checking `Tr::B`...
830
--> $DIR/defaults-cyclic-fail.rs:8:5
931
|
1032
LL | const B: u8 = Self::A;
1133
| ^^^^^^^^^^^^^^^^^^^^^^
12-
= note: ...which again requires const-evaluating + checking `Tr::A`, completing the cycle
34+
= note: ...which again requires normalizing `<() as Tr>::A`, completing the cycle
1335
note: cycle used when const-evaluating + checking `main::promoted[1]`
1436
--> $DIR/defaults-cyclic-fail.rs:14:1
1537
|

src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ LL | const BAR: u32 = TRAIT_REF_BAR;
66
|
77
= note: ...which requires normalizing `TRAIT_REF_BAR`...
88
note: ...which requires simplifying constant for the type system `TRAIT_REF_BAR`...
9+
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1
10+
|
11+
LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR;
12+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
913
note: ...which requires simplifying constant for the type system `TRAIT_REF_BAR`...
1014
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1
1115
|
@@ -27,9 +31,6 @@ note: ...which requires simplifying constant for the type system `<impl at $DIR/
2731
|
2832
LL | const BAR: u32 = TRAIT_REF_BAR;
2933
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30-
=======
31-
|
32-
>>>>>>> 53eca42efca (bless tests)
3334
note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 13:2>::BAR`...
3435
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:5
3536
|

src/test/ui/borrowck/issue-88434-minimal-example.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Regression test related to issue 88434
22

33
const _CONST: &() = &f(&|_| {});
4-
//~^ ERROR any use of this value will cause an error
5-
//~| WARNING this was previously accepted by the compiler but is being phased out
64

75
const fn f<F>(_: &F)
86
where
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,17 @@
11
error[E0080]: evaluation of constant value failed
2-
--> $DIR/issue-88434-minimal-example.rs:12:5
2+
--> $DIR/issue-88434-minimal-example.rs:9:5
33
|
44
LL | const _CONST: &() = &f(&|_| {});
55
| ---------- inside `_CONST` at $DIR/issue-88434-minimal-example.rs:3:22
66
...
77
LL | panic!()
88
| ^^^^^^^^
99
| |
10-
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:12:5
11-
| inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:4:25: 4:31]>` at $SRC_DIR/std/src/panic.rs:LL:COL
10+
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:9:5
11+
| inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:31]>` at $SRC_DIR/std/src/panic.rs:LL:COL
1212
|
1313
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
1414

15-
error: any use of this value will cause an error
16-
--> $DIR/issue-88434-minimal-example.rs:4:21
17-
|
18-
LL | const _CONST: &() = &f(&|_| {});
19-
| --------------------^^^^^^^^^^^-
20-
| |
21-
| referenced constant has errors
22-
|
23-
= note: `#[deny(const_err)]` on by default
24-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
25-
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
26-
27-
error: aborting due to 2 previous errors
15+
error: aborting due to previous error
2816

2917
For more information about this error, try `rustc --explain E0080`.

src/test/ui/borrowck/issue-88434-removal-index-should-be-less.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Regression test for issue 88434
22

33
const _CONST: &[u8] = &f(&[], |_| {});
4-
//~^ ERROR any use of this value will cause an error
5-
//~| WARNING this was previously
64

75
const fn f<F>(_: &[u8], _: F) -> &[u8]
86
where
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,17 @@
11
error[E0080]: evaluation of constant value failed
2-
--> $DIR/issue-88434-removal-index-should-be-less.rs:12:5
2+
--> $DIR/issue-88434-removal-index-should-be-less.rs:9:5
33
|
44
LL | const _CONST: &[u8] = &f(&[], |_| {});
55
| -------------- inside `_CONST` at $DIR/issue-88434-removal-index-should-be-less.rs:3:24
66
...
77
LL | panic!()
88
| ^^^^^^^^
99
| |
10-
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:12:5
11-
| inside `f::<[closure@$DIR/issue-88434-removal-index-should-be-less.rs:4:31: 4:37]>` at $SRC_DIR/std/src/panic.rs:LL:COL
10+
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:9:5
11+
| inside `f::<[closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:37]>` at $SRC_DIR/std/src/panic.rs:LL:COL
1212
|
1313
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
1414

15-
error: any use of this value will cause an error
16-
--> $DIR/issue-88434-removal-index-should-be-less.rs:4:23
17-
|
18-
LL | const _CONST: &[u8] = &f(&[], |_| {});
19-
| ----------------------^^^^^^^^^^^^^^^-
20-
| |
21-
| referenced constant has errors
22-
|
23-
= note: `#[deny(const_err)]` on by default
24-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
25-
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
26-
27-
error: aborting due to 2 previous errors
15+
error: aborting due to previous error
2816

2917
For more information about this error, try `rustc --explain E0080`.

src/test/ui/const-ptr/out_of_bounds_read.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed
44
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
| |
7-
| memory access failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
7+
| memory access failed: alloc7 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
88
| inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
99
|
1010
::: $DIR/out_of_bounds_read.rs:12:33
@@ -18,7 +18,7 @@ error[E0080]: evaluation of constant value failed
1818
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2020
| |
21-
| memory access failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
21+
| memory access failed: alloc7 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
2222
| inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
2323
|
2424
::: $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@@ -37,7 +37,7 @@ error[E0080]: evaluation of constant value failed
3737
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
3838
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3939
| |
40-
| memory access failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
40+
| memory access failed: alloc7 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
4141
| inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
4242
|
4343
::: $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL

src/test/ui/consts/const-eval/const-eval-query-stack.rs

-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,5 @@ const X: i32 = 1 / 0; //~WARN any use of this value will cause an error
2323
fn main() {
2424
let x: &'static i32 = &X;
2525
//~^ ERROR evaluation of constant value failed
26-
//~| ERROR erroneous constant used
27-
//~| WARNING this was previously accepted by the compiler
2826
println!("x={}", x);
2927
}

src/test/ui/consts/const-eval/const-eval-query-stack.stderr

+3-14
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,24 @@
11
warning: any use of this value will cause an error
2-
--> $DIR/const-eval-query-stack.rs:19:16
2+
--> $DIR/const-eval-query-stack.rs:20:16
33
|
44
LL | const X: i32 = 1 / 0;
55
| ---------------^^^^^-
66
| |
77
| attempt to divide `1_i32` by zero
88
|
99
note: the lint level is defined here
10-
--> $DIR/const-eval-query-stack.rs:18:8
10+
--> $DIR/const-eval-query-stack.rs:19:8
1111
|
1212
LL | #[warn(const_err)]
1313
| ^^^^^^^^^
1414
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
1515
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
1616

1717
error[E0080]: evaluation of constant value failed
18-
--> $DIR/const-eval-query-stack.rs:23:28
18+
--> $DIR/const-eval-query-stack.rs:24:28
1919
|
2020
LL | let x: &'static i32 = &X;
2121
| ^ referenced constant has errors
22-
23-
error: erroneous constant used
24-
--> $DIR/const-eval-query-stack.rs:23:27
25-
|
26-
LL | let x: &'static i32 = &X;
27-
| ^^ referenced constant has errors
28-
|
29-
= note: `#[deny(const_err)]` on by default
30-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
31-
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
32-
3322
query stack during panic:
3423
#0 [try_normalize_mir_const_after_erasing_regions] normalizing `main::promoted[1]`
3524
#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `main`

0 commit comments

Comments
 (0)