From ab8a769c576603164816ee9df7edee544182a878 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Tue, 3 Mar 2015 19:43:31 -0500 Subject: [PATCH] Extend the "treat-err-as-bug" option to cover calls to fatal. --- src/librustc/session/mod.rs | 9 +++++++++ 1 file changed, 9 insertions(+) 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) {