diff options
| author | Zack M. Davis <code@zackmdavis.net> | 2018-03-11 00:04:15 -0800 |
|---|---|---|
| committer | Zack M. Davis <code@zackmdavis.net> | 2018-03-11 00:12:06 -0800 |
| commit | 9b599856a4b7e375e4e54eb759c250be969f5562 (patch) | |
| tree | 57b2184cdf8b196487c70d2b696ae8d40f1a9a61 /src/libsyntax/parse/parser.rs | |
| parent | 2f0e6a3ba585e00205805d6cb9fdcbe4b1d1be63 (diff) | |
| download | rust-9b599856a4b7e375e4e54eb759c250be969f5562.tar.gz rust-9b599856a4b7e375e4e54eb759c250be969f5562.zip | |
in which some labels and notes are upgraded to structured suggestions
(Meanwhile, a couple of parse-fail tests are moved to UI tests so that the reader can see the new output, and an existing UI test is given a more evocative name.)
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index f5aa01fb034..bd0ca0e6704 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2831,9 +2831,10 @@ impl<'a> Parser<'a> { let (span, e) = self.interpolated_or_expr_span(e)?; let span_of_tilde = lo; let mut err = self.diagnostic().struct_span_err(span_of_tilde, - "`~` can not be used as a unary operator"); - err.span_label(span_of_tilde, "did you mean `!`?"); - err.help("use `!` instead of `~` if you meant to perform bitwise negation"); + "`~` cannot be used as a unary operator"); + err.span_suggestion_short(span_of_tilde, + "use `!` to perform bitwise negation", + "!".to_owned()); err.emit(); (lo.to(span), self.mk_unary(UnOp::Not, e)) } @@ -3389,7 +3390,7 @@ impl<'a> Parser<'a> { None)?; if let Err(mut e) = self.expect(&token::OpenDelim(token::Brace)) { if self.token == token::Token::Semi { - e.span_note(match_span, "did you mean to remove this `match` keyword?"); + e.span_suggestion_short(match_span, "try removing this `match`", "".to_owned()); } return Err(e) } @@ -5361,7 +5362,9 @@ impl<'a> Parser<'a> { if is_macro_rules { let mut err = self.diagnostic() .struct_span_err(sp, "can't qualify macro_rules invocation with `pub`"); - err.help("did you mean #[macro_export]?"); + err.span_suggestion(sp, + "try exporting the macro", + "#[macro_export]".to_owned()); Err(err) } else { let mut err = self.diagnostic() |
