about summary refs log tree commit diff
path: root/tests/ui/codegen/rvalue-mut-ref-box-drop.rs
blob: 441820ad64e4315de2eaf7eee7d3de7ef7d31dc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
//! 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));
}