diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index 67c39bcca81f..560b2a0ed6a8 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -64,12 +64,21 @@ pub struct Session { impl Session { pub fn span_fatal(&self, sp: Span, msg: &str) -> ! { + if self.opts.treat_err_as_bug { + self.span_bug(sp, msg); + } self.diagnostic().span_fatal(sp, msg) } pub fn span_fatal_with_code(&self, sp: Span, msg: &str, code: &str) -> ! { + if self.opts.treat_err_as_bug { + self.span_bug(sp, msg); + } self.diagnostic().span_fatal_with_code(sp, msg, code) } pub fn fatal(&self, msg: &str) -> ! { + if self.opts.treat_err_as_bug { + self.bug(msg); + } self.diagnostic().handler().fatal(msg) } pub fn span_err(&self, sp: Span, msg: &str) {