about summary refs log tree commit diff
path: root/src/librustc_errors
diff options
context:
space:
mode:
authorDavid Wood <david@davidtw.co>2019-10-06 23:14:34 +0100
committerDavid Wood <david@davidtw.co>2019-12-08 16:29:08 +0000
commit438455d18bb45e20cf11f06622e95ecf9c4209c4 (patch)
tree4b1d2ab98179774f1c5d5743feeddcc6792a138c /src/librustc_errors
parente862c01aadb2d029864f7bb256cf6c85bbb5d7e4 (diff)
downloadrust-438455d18bb45e20cf11f06622e95ecf9c4209c4.tar.gz
rust-438455d18bb45e20cf11f06622e95ecf9c4209c4.zip
async/await: more improvements to non-send errors
Signed-off-by: David Wood <david@davidtw.co>
Diffstat (limited to 'src/librustc_errors')
-rw-r--r--src/librustc_errors/diagnostic.rs10
1 files changed, 10 insertions, 0 deletions
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<DiagnosticId> {
         self.code.clone()
     }
 
+    pub fn set_primary_message<M: Into<String>>(&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::<String>()
     }