rust/tests/ui/codegen/rvalue-mut-ref-box-drop.rs
2025-06-04 17:48:50 +05:00

14 lines
254 B
Rust

//! Tests cleanup of a temporary `Box` rvalue passed as a mutable reference.
//!
//! - Issue: <https://github.com/rust-lang/rust/issues/7972>.
//@ run-pass
fn foo(x: &mut Box<u8>) {
*x = Box::new(5);
}
pub fn main() {
foo(&mut Box::new(4));
}