From a333be7cfecbbe9a659f4f180978fa4dd74d455d Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 29 May 2017 18:46:29 +0200 Subject: Add new error code --- src/librustc_errors/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/librustc_errors') diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index f7191e49216..d1aaaf4ba7b 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -345,9 +345,15 @@ impl Handler { result.code(code.to_owned()); result } + // FIXME: This method should be removed (every error should have an associated error code). pub fn struct_err<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> { DiagnosticBuilder::new(self, Level::Error, msg) } + pub fn struct_err_with_code<'a>(&'a self, msg: &str, code: &str) -> DiagnosticBuilder<'a> { + let mut result = DiagnosticBuilder::new(self, Level::Error, msg); + result.code(code.to_owned()); + result + } pub fn struct_span_fatal<'a, S: Into>(&'a self, sp: S, msg: &str) -- cgit 1.4.1-3-g733a5