mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 03:33:59 +00:00
19 lines
242 B
Rust
19 lines
242 B
Rust
|
// run-rustfix
|
||
|
struct Foo {
|
||
|
x: i32,
|
||
|
}
|
||
|
|
||
|
impl Drop for Foo {
|
||
|
fn drop(&mut self) {
|
||
|
println!("kaboom");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
fn main() {
|
||
|
let mut x = Foo { x: -7 };
|
||
|
x.x = 0;
|
||
|
println!("{}", x.x);
|
||
|
drop(x);
|
||
|
//~^ ERROR E0040
|
||
|
}
|