2023-04-29 22:33:57 -07:00
|
|
|
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
|
|
|
|
// only-64bit
|
2023-08-24 13:46:37 +02:00
|
|
|
// ignore-debug the standard library debug assertions leak into this test
|
2023-04-29 22:33:57 -07: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)
|
|
|
|
}
|