-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #125739 - RalfJung:drop-in-place-docs, r=workingjubilee
drop_in_place: weaken the claim of equivalence with drop(ptr.read()) The two are *not* semantically equivalent in all cases, so let's not be so definite about this. Fixes #112015
- Loading branch information
Showing
2 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Miri currently doesn't require types without drop glue to be | ||
// valid when dropped. This test confirms that behavior. | ||
// This is not a stable guarantee! | ||
|
||
use std::ptr; | ||
|
||
fn main() { | ||
let mut not_a_bool = 13u8; | ||
unsafe { | ||
ptr::drop_in_place(&mut not_a_bool as *mut u8 as *mut bool) | ||
}; | ||
} |