Skip to content

Commit e0e0211

Browse files
committed
Retag argument to drop_in_place unconditionally
1 parent 1d497c1 commit e0e0211

File tree

5 files changed

+5
-19
lines changed

5 files changed

+5
-19
lines changed

tests/fail/stacked_borrows/drop_in_place_protector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ impl Drop for HasDrop {
1010
fn drop(&mut self) {
1111
unsafe {
1212
let _val = *P;
13-
//~^ ERROR: /not granting access .* because that would remove .* which is protected/
13+
//~^ ERROR: /not granting access .* because that would remove .* which is strongly protected/
1414
}
1515
}
1616
}

tests/fail/stacked_borrows/drop_in_place_protector.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: not granting access to tag <TAG> because that would remove [Unique for <TAG>] which is protected because it is an argument of call ID
1+
error: Undefined Behavior: not granting access to tag <TAG> because that would remove [Unique for <TAG>] which is strongly protected because it is an argument of call ID
22
--> $DIR/drop_in_place_protector.rs:LL:CC
33
|
44
LL | let _val = *P;
5-
| ^^ not granting access to tag <TAG> because that would remove [Unique for <TAG>] which is protected because it is an argument of call ID
5+
| ^^ not granting access to tag <TAG> because that would remove [Unique for <TAG>] which is strongly protected because it is an argument of call ID
66
|
77
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
88
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information

tests/fail/stacked_borrows/drop_in_place_retag.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,9 @@
33
44
//@error-pattern: /retag .* for Unique permission .* only grants SharedReadOnly permission/
55

6-
#[repr(transparent)]
7-
struct HasDrop;
8-
9-
impl Drop for HasDrop {
10-
fn drop(&mut self) {}
11-
}
12-
136
fn main() {
147
unsafe {
15-
let x = (0u8, HasDrop);
8+
let x = 0u8;
169
let x = core::ptr::addr_of!(x);
1710
core::ptr::drop_in_place(x.cast_mut());
1811
}

tests/fail/stacked_borrows/drop_in_place_retag.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ help: <TAG> was created by a SharedReadOnly retag at offsets [0x0..0x1]
1515
LL | let x = core::ptr::addr_of!(x);
1616
| ^^^^^^^^^^^^^^^^^^^^^^
1717
= note: BACKTRACE:
18-
= note: inside `std::ptr::drop_in_place::<(u8, HasDrop)> - shim(Some((u8, HasDrop)))` at RUSTLIB/core/src/ptr/mod.rs:LL:CC
18+
= note: inside `std::ptr::drop_in_place::<u8> - shim(None)` at RUSTLIB/core/src/ptr/mod.rs:LL:CC
1919
note: inside `main` at $DIR/drop_in_place_retag.rs:LL:CC
2020
--> $DIR/drop_in_place_retag.rs:LL:CC
2121
|

tests/pass/drop_in_place_null.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)