rust/tests/compile-fail/mem_forget.rs

22 lines
412 B
Rust
Raw Normal View History

2016-04-20 15:10:23 -05:00
#![feature(plugin)]
#![plugin(clippy)]
use std::sync::Arc;
use std::mem::forget as forgetSomething;
use std::mem as memstuff;
#[deny(mem_forget)]
fn main() {
let five: i32 = 5;
forgetSomething(five);
//~^ ERROR usage of mem::forget
2016-04-20 15:10:23 -05:00
let six: Arc<i32> = Arc::new(6);
memstuff::forget(six);
//~^ ERROR usage of mem::forget
2016-04-20 15:10:23 -05:00
std::mem::forget(7);
//~^ ERROR usage of mem::forget
2016-04-20 15:10:23 -05:00
}