From 3a7dbf48feb325bbe8517bc0fd7546e80931c8ed Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Sun, 11 Jun 2017 23:47:26 -0700 Subject: Suggest non-ambiguous comparison after cast ``` warning: `<` is interpreted as a start of generic arguments for `usize`, not comparison --> $DIR/issue-22644.rs:16:33 | 16 | println!("{}", a as usize < b); | ^ expected one of `!`, `(`, `+`, `,`, `::`, or `>` here | help: if you want to compare the casted value then write | println!("{}", (a as usize) < b); ``` --- src/librustc_errors/diagnostic.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/librustc_errors') diff --git a/src/librustc_errors/diagnostic.rs b/src/librustc_errors/diagnostic.rs index 7a64cdeee65..d7c21127474 100644 --- a/src/librustc_errors/diagnostic.rs +++ b/src/librustc_errors/diagnostic.rs @@ -248,6 +248,10 @@ impl Diagnostic { self.message.iter().map(|i| i.0.to_owned()).collect::() } + pub fn set_message(&mut self, message: &str) { + self.message = vec![(message.to_owned(), Style::NoStyle)]; + } + pub fn styled_message(&self) -> &Vec<(String, Style)> { &self.message } -- cgit 1.4.1-3-g733a5