Skip to content

Commit db8a9a9

Browse files
committed
avoid double panic
1 parent 9d151a7 commit db8a9a9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libsyntax/errors/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use errors::emitter::{Emitter, EmitterWriter};
2020
use std::cell::{RefCell, Cell};
2121
use std::{error, fmt};
2222
use std::rc::Rc;
23+
use std::thread::panicking;
2324
use term;
2425

2526
pub mod emitter;
@@ -352,7 +353,7 @@ impl<'a> fmt::Debug for DiagnosticBuilder<'a> {
352353
/// we emit a bug.
353354
impl<'a> Drop for DiagnosticBuilder<'a> {
354355
fn drop(&mut self) {
355-
if !self.cancelled() {
356+
if !panicking() && !self.cancelled() {
356357
self.emitter.borrow_mut().emit(&MultiSpan::new(),
357358
"Error constructed but not emitted",
358359
None,

0 commit comments

Comments
 (0)