You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See #2734. In that sample code, which segfaults, removing the characters "let _ =" causes it to no longer segfault. No idea why; maybe it causes it to optimise away the destructor call?
The text was updated successfully, but these errors were encountered:
This is still in the air. The following code prints "First" then "Second", but without the let _ =, it prints "Second" then "First".
class defer {
f: fn@();
new(f: fn@()) {
self.f = f;
}
drop { self.f(); }
}
fn main() {
let _ = do defer {
#error["Second"];
};
#error["First"];
}
I'm not sure if the answer is "Well, too bad, there are no guarantees on when destructors get run", but I want to add this defer thing to libcore, and can't in good conscience as long as its behaviour is unpredictable.
See #2734. In that sample code, which segfaults, removing the characters "let _ =" causes it to no longer segfault. No idea why; maybe it causes it to optimise away the destructor call?
The text was updated successfully, but these errors were encountered: