rust/tests/run-pass/leak-in-static.rs

9 lines
182 B
Rust

static mut LEAKER: Option<Box<Vec<i32>>> = None;
fn main() {
// Having memory "leaked" in globals is allowed.
unsafe {
LEAKER = Some(Box::new(vec![0; 42]));
}
}