Closed
Description
class C {
let x: int;
new(x: int) { self.x = x; }
drop {
#error("dropping: %?", self.x);
}
}
fn main() {
let c = C(2);
let d = copy c;
#error("%?", d.x);
}
Even though the class has a destructor, it is valid rust code because it seems rust is ignoring the explicit copy because let d = copy c
is the last use of c
. I feel this is confusing, so I think rustc should report an error here.
Metadata
Metadata
Assignees
Labels
No labels