Closed
Description
I believe the issue is simply that destructors are run in regardless order of borrows. Instead, the destructors with borrows should run first.
This code prints, rust: ~"bye \xffffff91"
class defer {
x: &str;
new(x: &str) { self.x = x; }
drop { #error["%s", self.x]; }
}
fn main() {
let _x = defer(~"Goodbye world!");
#error["..."];
}
and this code segfaults:
class defer {
x: &[&str];
new(x: &[&str]) { self.x = x; }
drop { #error["%?", self.x]; }
}
fn main() {
let _x = defer(~["Goodbye", "world!"]);
}