Skip to content

Commit 8f3ff87

Browse files
committed
update ui test
1 parent 25c44f4 commit 8f3ff87

7 files changed

+64
-69
lines changed

src/tools/miri/tests/fail/stacked_borrows/drop_in_place_retag.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: Undefined Behavior: trying to retag from <TAG> for Unique permission at ALLOC[0x0], but that tag only grants SharedReadOnly permission for this location
22
--> RUSTLIB/core/src/ptr/mod.rs:LL:CC
33
|
4-
LL | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
LL | pub const unsafe fn drop_in_place<T: ?Sized + ~const Destruct>(to_drop: *mut T) {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
| |
77
| trying to retag from <TAG> for Unique permission at ALLOC[0x0], but that tag only grants SharedReadOnly permission for this location
88
| this error occurs as part of retag at ALLOC[0x0..0x1]

src/tools/miri/tests/fail/unaligned_pointers/drop_in_place.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: Undefined Behavior: accessing memory with alignment ALIGN, but alignment ALIGN is required
22
--> RUSTLIB/core/src/ptr/mod.rs:LL:CC
33
|
4-
LL | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ accessing memory with alignment ALIGN, but alignment ALIGN is required
4+
LL | pub const unsafe fn drop_in_place<T: ?Sized + ~const Destruct>(to_drop: *mut T) {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ accessing memory with alignment ALIGN, but alignment ALIGN is required
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
// MIR for `std::ptr::drop_in_place` after SimplifyCfg-make_shim
22

33
fn std::ptr::drop_in_place(_1: *mut Test) -> () {
4-
let mut _0: (); // return place in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
5-
let mut _2: &mut Test; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
6-
let mut _3: &mut Test; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
7-
let mut _4: (); // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
4+
let mut _0: (); // return place in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
5+
let mut _2: &mut Test; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
6+
let mut _3: &mut Test; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
7+
let mut _4: (); // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
88

99
bb0: {
10-
_2 = &mut (*_1); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
11-
Retag([fn entry] _2); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
12-
_3 = &mut (*_2); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
13-
_4 = <Test as Drop>::drop(move _3) -> bb1; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
10+
_2 = &mut (*_1); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
11+
Retag([fn entry] _2); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
12+
_3 = &mut (*_2); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
13+
_4 = <Test as Drop>::drop(move _3) -> bb1; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
1414
// mir::Constant
1515
// + span: $SRC_DIR/core/src/ptr/mod.rs:LL:COL
1616
// + literal: Const { ty: for<'a> fn(&'a mut Test) {<Test as Drop>::drop}, val: Value(<ZST>) }
1717
}
1818

1919
bb1: {
20-
return; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
20+
return; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
2121
}
2222
}
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
11
// MIR for `std::ptr::drop_in_place` before AddMovesForPackedDrops
22

33
fn std::ptr::drop_in_place(_1: *mut [String]) -> () {
4-
let mut _0: (); // return place in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
5-
let mut _2: usize; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
6-
let mut _3: usize; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
7-
let mut _4: *mut std::string::String; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
8-
let mut _5: bool; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
9-
let mut _6: *mut std::string::String; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
10-
let mut _7: bool; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
4+
let mut _0: (); // return place in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
5+
let mut _2: usize; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
6+
let mut _3: usize; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
7+
let mut _4: *mut std::string::String; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
8+
let mut _5: bool; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
9+
let mut _6: *mut std::string::String; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
10+
let mut _7: bool; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
1111

1212
bb0: {
13-
goto -> bb8; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
13+
goto -> bb8; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
1414
}
1515

1616
bb1: {
17-
return; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
17+
return; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
1818
}
1919

2020
bb2 (cleanup): {
21-
resume; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
21+
resume; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
2222
}
2323

2424
bb3 (cleanup): {
25-
_4 = &raw mut (*_1)[_3]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
26-
_3 = Add(move _3, const 1_usize); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
27-
drop((*_4)) -> bb4; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
25+
_4 = &raw mut (*_1)[_3]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
26+
_3 = Add(move _3, const 1_usize); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
27+
drop((*_4)) -> bb4; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
2828
}
2929

3030
bb4 (cleanup): {
31-
_5 = Eq(_3, _2); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
32-
switchInt(move _5) -> [0: bb3, otherwise: bb2]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
31+
_5 = Eq(_3, _2); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
32+
switchInt(move _5) -> [0: bb3, otherwise: bb2]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
3333
}
3434

3535
bb5: {
36-
_6 = &raw mut (*_1)[_3]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
37-
_3 = Add(move _3, const 1_usize); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
38-
drop((*_6)) -> [return: bb6, unwind: bb4]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
36+
_6 = &raw mut (*_1)[_3]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
37+
_3 = Add(move _3, const 1_usize); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
38+
drop((*_6)) -> [return: bb6, unwind: bb4]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
3939
}
4040

4141
bb6: {
42-
_7 = Eq(_3, _2); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
43-
switchInt(move _7) -> [0: bb5, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
42+
_7 = Eq(_3, _2); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
43+
switchInt(move _7) -> [0: bb5, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
4444
}
4545

4646
bb7: {
47-
_2 = Len((*_1)); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
48-
_3 = const 0_usize; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
49-
goto -> bb6; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
47+
_2 = Len((*_1)); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
48+
_3 = const 0_usize; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
49+
goto -> bb6; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
5050
}
5151

5252
bb8: {
53-
goto -> bb7; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
53+
goto -> bb7; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
5454
}
5555
}

tests/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.mir

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
// MIR for `std::ptr::drop_in_place` before AddMovesForPackedDrops
22

33
fn std::ptr::drop_in_place(_1: *mut Vec<i32>) -> () {
4-
let mut _0: (); // return place in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
5-
let mut _2: &mut std::vec::Vec<i32>; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
6-
let mut _3: (); // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
4+
let mut _0: (); // return place in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
5+
let mut _2: &mut std::vec::Vec<i32>; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
6+
let mut _3: (); // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
77

88
bb0: {
9-
goto -> bb6; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
9+
goto -> bb6; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
1010
}
1111

1212
bb1: {
13-
return; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
13+
return; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
1414
}
1515

1616
bb2 (cleanup): {
17-
resume; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
17+
resume; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
1818
}
1919

2020
bb3: {
21-
goto -> bb1; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
21+
goto -> bb1; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
2222
}
2323

2424
bb4 (cleanup): {
25-
drop(((*_1).0: alloc::raw_vec::RawVec<i32>)) -> bb2; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
25+
drop(((*_1).0: alloc::raw_vec::RawVec<i32>)) -> bb2; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
2626
}
2727

2828
bb5: {
29-
drop(((*_1).0: alloc::raw_vec::RawVec<i32>)) -> [return: bb3, unwind: bb2]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
29+
drop(((*_1).0: alloc::raw_vec::RawVec<i32>)) -> [return: bb3, unwind: bb2]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
3030
}
3131

3232
bb6: {
33-
_2 = &mut (*_1); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
34-
_3 = <Vec<i32> as Drop>::drop(move _2) -> [return: bb5, unwind: bb4]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
33+
_2 = &mut (*_1); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
34+
_3 = <Vec<i32> as Drop>::drop(move _2) -> [return: bb5, unwind: bb4]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:80
3535
// mir::Constant
3636
// + span: $SRC_DIR/core/src/ptr/mod.rs:LL:COL
3737
// + literal: Const { ty: for<'a> fn(&'a mut Vec<i32>) {<Vec<i32> as Drop>::drop}, val: Value(<ZST>) }

tests/ui/consts/issue-102117.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ impl VTable {
1717
&VTable {
1818
layout: Layout::new::<T>(),
1919
type_id: TypeId::of::<T>(),
20-
//~^ ERROR the parameter type `T` may not live long enough
21-
//~| ERROR the parameter type `T` may not live long enough
2220
drop_in_place: unsafe {
2321
transmute::<unsafe fn(*mut T), unsafe fn(*mut ())>(drop_in_place::<T>)
22+
//~^ ERROR can't drop `T` in const contexts
2423
},
2524
}
2625
}

tests/ui/consts/issue-102117.stderr

+15-19
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
1-
error[E0310]: the parameter type `T` may not live long enough
2-
--> $DIR/issue-102117.rs:19:26
1+
error[E0277]: can't drop `T` in const contexts
2+
--> $DIR/issue-102117.rs:21:88
33
|
4-
LL | type_id: TypeId::of::<T>(),
5-
| ^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
4+
LL | transmute::<unsafe fn(*mut T), unsafe fn(*mut ())>(drop_in_place::<T>)
5+
| ^ the trait `~const Destruct` is not implemented for `T`
66
|
7-
help: consider adding an explicit lifetime bound...
7+
note: the trait `Destruct` is implemented for `T`, but that implementation is not `const`
8+
--> $DIR/issue-102117.rs:21:88
89
|
9-
LL | pub fn new<T: 'static>() -> &'static Self {
10-
| +++++++++
11-
12-
error[E0310]: the parameter type `T` may not live long enough
13-
--> $DIR/issue-102117.rs:19:26
14-
|
15-
LL | type_id: TypeId::of::<T>(),
16-
| ^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
17-
|
18-
help: consider adding an explicit lifetime bound...
10+
LL | transmute::<unsafe fn(*mut T), unsafe fn(*mut ())>(drop_in_place::<T>)
11+
| ^
12+
note: required by a bound in `std::ptr::drop_in_place`
13+
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
14+
help: consider restricting type parameter `T`
1915
|
20-
LL | pub fn new<T: 'static>() -> &'static Self {
21-
| +++++++++
16+
LL | pub fn new<T: ~const std::marker::Destruct>() -> &'static Self {
17+
| ++++++++++++++++++++++++++++++
2218

23-
error: aborting due to 2 previous errors
19+
error: aborting due to previous error
2420

25-
For more information about this error, try `rustc --explain E0310`.
21+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)