mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-22 18:15:07 +03:00
avoid double panic
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
use std::cell::{RefCell, Cell};
|
||||
use std::{error, fmt};
|
||||
use std::rc::Rc;
|
||||
use std::thread::panicking;
|
||||
use term;
|
||||
|
||||
pub mod emitter;
|
||||
@@ -352,7 +353,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
/// we emit a bug.
|
||||
impl<'a> Drop for DiagnosticBuilder<'a> {
|
||||
fn drop(&mut self) {
|
||||
if !self.cancelled() {
|
||||
if !panicking() && !self.cancelled() {
|
||||
self.emitter.borrow_mut().emit(&MultiSpan::new(),
|
||||
"Error constructed but not emitted",
|
||||
None,
|
||||
|
||||
Reference in New Issue
Block a user