On Wed, Oct 16, 2013 at 3:38 PM, Patrick Walton <[email protected]> wrote:

> There's no difference except that "let _" runs the destructor immediately
> whereas "let _foo" runs the destructor at the end of the block. (This is
> admittedly subtle.)
>
>

I tried the following code snippet, but nothing got printed out. What am I
missing?

-- cut --

struct S;

impl Drop for S {
    fn drop(&mut self) {
        println("drop");
    }
}

fn main() {
    let _ = S;
}


--end cut --

Replacing `let _` with `let _s` printed "drop" as expected.

Thanks

--
Ziad
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to