Closed
Description
This code compiles successfully:
trait A {}
impl<'self> A for &'self mut A {}
fn foo(t: &mut A) -> ~A: {
~t as ~A:
}
struct B;
impl A for B {}
impl Drop for B {
fn drop(&mut self) {
println!("dropping");
}
}
fn main() {
let _tmp = {
let mut b = B;
foo(&mut b as &mut A)
};
println!("after conversion");
}
and yields the output of
$ ./foo
dropping
after conversion
The value b
has been dropped by the time that after conversion
is printed, yet we still have a reference to it via the _tmp
handle.
Nominating for backwards-compatibility
Metadata
Metadata
Assignees
Labels
No labels