From 438455d18bb45e20cf11f06622e95ecf9c4209c4 Mon Sep 17 00:00:00 2001 From: David Wood Date: Sun, 6 Oct 2019 23:14:34 +0100 Subject: async/await: more improvements to non-send errors Signed-off-by: David Wood --- src/librustc_errors/diagnostic.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/librustc_errors') diff --git a/src/librustc_errors/diagnostic.rs b/src/librustc_errors/diagnostic.rs index abec979054e..744f4a47b60 100644 --- a/src/librustc_errors/diagnostic.rs +++ b/src/librustc_errors/diagnostic.rs @@ -498,10 +498,20 @@ impl Diagnostic { self } + pub fn clear_code(&mut self) -> &mut Self { + self.code = None; + self + } + pub fn get_code(&self) -> Option { self.code.clone() } + pub fn set_primary_message>(&mut self, msg: M) -> &mut Self { + self.message[0] = (msg.into(), Style::NoStyle); + self + } + pub fn message(&self) -> String { self.message.iter().map(|i| i.0.as_str()).collect::() } -- cgit 1.4.1-3-g733a5