Fix make_permanent logic

Don't invoke callbacks when `make_permanent` is called
This commit is contained in:
Alex Crichton
2017-10-30 18:49:08 -07:00
parent 9ba60f294e
commit 483d3abcaa

View File

@@ -79,14 +79,15 @@ mod std_support {
fn drop(&mut self) {
ENTERED.with(|c| {
assert!(c.get());
if self.permanent {
return
}
let mut on_exit = self.on_exit.borrow_mut();
for callback in on_exit.drain(..) {
callback.call();
}
if !self.permanent {
c.set(false);
}
c.set(false);
});
}
}