2023-10-16 12:36:39 -05:00
|
|
|
// skip-filecheck
|
2024-02-07 09:30:39 -06:00
|
|
|
//@ compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 -Zinline-mir
|
2024-10-18 21:20:40 -05:00
|
|
|
//@ ignore-std-debug-assertions
|
|
|
|
// Reason: precondition checks on ptr::read/write are under cfg(debug_assertions)
|
2024-02-07 09:30:39 -06:00
|
|
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
2023-04-30 00:33:57 -05:00
|
|
|
|
|
|
|
#![crate_type = "lib"]
|
|
|
|
|
|
|
|
// EMIT_MIR mem_replace.manual_replace.PreCodegen.after.mir
|
|
|
|
pub fn manual_replace(r: &mut u32, v: u32) -> u32 {
|
|
|
|
let temp = *r;
|
|
|
|
*r = v;
|
|
|
|
temp
|
|
|
|
}
|
|
|
|
|
|
|
|
// EMIT_MIR mem_replace.mem_replace.PreCodegen.after.mir
|
|
|
|
pub fn mem_replace(r: &mut u32, v: u32) -> u32 {
|
|
|
|
std::mem::replace(r, v)
|
|
|
|
}
|