mirror of
https://github.com/serde-rs/serde.git
synced 2025-09-28 05:21:05 +00:00
Drop impl should only panic if not already panicking
This commit is contained in:
parent
69dd3215f4
commit
5bc805329e
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
use std::thread;
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Ctxt {
|
pub struct Ctxt {
|
||||||
@ -48,7 +49,7 @@ impl Ctxt {
|
|||||||
|
|
||||||
impl Drop for Ctxt {
|
impl Drop for Ctxt {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if self.errors.borrow().is_some() {
|
if !thread::panicking() && self.errors.borrow().is_some() {
|
||||||
panic!("forgot to check for errors");
|
panic!("forgot to check for errors");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user