diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2016-04-20 14:49:16 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2016-05-02 11:49:23 -0400 |
| commit | 489a6c95bf747059b28472efc17d39795c6adcad (patch) | |
| tree | 8291d94bde59caa3b22d2ab3366af46dc5519751 /src/libsyntax | |
| parent | 1ff1887cc9537cf45c2bc405ce0b026ef9a2246a (diff) | |
| download | rust-489a6c95bf747059b28472efc17d39795c6adcad.tar.gz rust-489a6c95bf747059b28472efc17d39795c6adcad.zip | |
replace fileline_{help,note} with {help,note}
The extra filename and line was mainly there to keep the indentation relative to the main snippet; now that this doesn't include filename/line-number as a prefix, it is distracted.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/diagnostics/macros.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/ext/base.rs | 7 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/parse/attr.rs | 5 | ||||
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 21 |
6 files changed, 26 insertions, 29 deletions
diff --git a/src/libsyntax/diagnostics/macros.rs b/src/libsyntax/diagnostics/macros.rs index 95a74d87554..25e0428248d 100644 --- a/src/libsyntax/diagnostics/macros.rs +++ b/src/libsyntax/diagnostics/macros.rs @@ -101,9 +101,9 @@ macro_rules! span_help { } #[macro_export] -macro_rules! fileline_help { - ($err:expr, $span:expr, $($message:tt)*) => ({ - ($err).fileline_help($span, &format!($($message)*)); +macro_rules! help { + ($err:expr, $($message:tt)*) => ({ + ($err).help(&format!($($message)*)); }) } diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index c0306b8494b..303187aeba8 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -764,15 +764,14 @@ impl<'a> ExtCtxt<'a> { pub fn suggest_macro_name(&mut self, name: &str, - span: Span, err: &mut DiagnosticBuilder<'a>) { let names = &self.syntax_env.names; if let Some(suggestion) = find_best_match_for_name(names.iter(), name, None) { if suggestion != name { - err.fileline_help(span, &format!("did you mean `{}!`?", suggestion)); + err.help(&format!("did you mean `{}!`?", suggestion)); } else { - err.fileline_help(span, &format!("have you added the `#[macro_use]` on the \ - module/import?")); + err.help(&format!("have you added the `#[macro_use]` on the \ + module/import?")); } } } diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index ed2371fc348..e269475d1e2 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -770,9 +770,9 @@ pub fn emit_feature_err(diag: &Handler, feature: &str, span: Span, issue: GateIs err.emit(); return; } - err.fileline_help(span, &format!("add #![feature({})] to the \ - crate attributes to enable", - feature)); + err.help(&format!("add #![feature({})] to the \ + crate attributes to enable", + feature)); err.emit(); } diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index b8e320e36e9..3aac12d76ff 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -69,9 +69,8 @@ impl<'a> Parser<'a> { self.diagnostic() .struct_span_err(span, "an inner attribute is not permitted in this context") - .fileline_help(span, - "place inner attribute at the top of the module or \ - block") + .help("place inner attribute at the top of the module or \ + block") .emit() } ast::AttrStyle::Inner diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index c2050d2a8f4..2a9bcfd658c 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -445,11 +445,11 @@ fn filtered_float_lit(data: token::InternedString, suffix: Option<&str>, if suf.len() >= 2 && looks_like_width_suffix(&['f'], suf) { // if it looks like a width, lets try to be helpful. sd.struct_span_err(sp, &format!("invalid width `{}` for float literal", &suf[1..])) - .fileline_help(sp, "valid widths are 32 and 64") + .help("valid widths are 32 and 64") .emit(); } else { sd.struct_span_err(sp, &format!("invalid suffix `{}` for float literal", suf)) - .fileline_help(sp, "valid suffixes are `f32` and `f64`") + .help("valid suffixes are `f32` and `f64`") .emit(); } @@ -621,12 +621,12 @@ pub fn integer_lit(s: &str, if looks_like_width_suffix(&['i', 'u'], suf) { sd.struct_span_err(sp, &format!("invalid width `{}` for integer literal", &suf[1..])) - .fileline_help(sp, "valid widths are 8, 16, 32 and 64") + .help("valid widths are 8, 16, 32 and 64") .emit(); } else { sd.struct_span_err(sp, &format!("invalid suffix `{}` for numeric literal", suf)) - .fileline_help(sp, "the suffix must be one of the integral types \ - (`u32`, `isize`, etc)") + .help("the suffix must be one of the integral types \ + (`u32`, `isize`, etc)") .emit(); } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 671a11b57de..b9188f5101d 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -583,7 +583,7 @@ impl<'a> Parser<'a> { let mut err = self.fatal(&format!("expected identifier, found `{}`", self.this_token_to_string())); if self.token == token::Underscore { - err.fileline_note(self.span, "`_` is a wildcard pattern, not an identifier"); + err.note("`_` is a wildcard pattern, not an identifier"); } Err(err) } @@ -1082,7 +1082,7 @@ impl<'a> Parser<'a> { } pub fn span_fatal_help(&self, sp: Span, m: &str, help: &str) -> DiagnosticBuilder<'a> { let mut err = self.sess.span_diagnostic.struct_span_fatal(sp, m); - err.fileline_help(sp, help); + err.help(help); err } pub fn bug(&self, m: &str) -> ! { @@ -2622,10 +2622,9 @@ impl<'a> Parser<'a> { Some(f) => f, None => continue, }; - err.fileline_help(last_span, - &format!("try parenthesizing the first index; e.g., `(foo.{}){}`", - float.trunc() as usize, - format!(".{}", fstr.splitn(2, ".").last().unwrap()))); + err.help(&format!("try parenthesizing the first index; e.g., `(foo.{}){}`", + float.trunc() as usize, + format!(".{}", fstr.splitn(2, ".").last().unwrap()))); } return Err(err); @@ -3134,7 +3133,7 @@ impl<'a> Parser<'a> { let mut err = self.diagnostic().struct_span_err(op_span, "chained comparison operators require parentheses"); if op.node == BinOpKind::Lt && *outer_op == AssocOp::Greater { - err.fileline_help(op_span, + err.help( "use `::<...>` instead of `<...>` if you meant to specify type arguments"); } err.emit(); @@ -4951,13 +4950,13 @@ impl<'a> Parser<'a> { if is_macro_rules { self.diagnostic().struct_span_err(span, "can't qualify macro_rules \ invocation with `pub`") - .fileline_help(span, "did you mean #[macro_export]?") + .help("did you mean #[macro_export]?") .emit(); } else { self.diagnostic().struct_span_err(span, "can't qualify macro \ invocation with `pub`") - .fileline_help(span, "try adjusting the macro to put `pub` \ - inside the invocation") + .help("try adjusting the macro to put `pub` \ + inside the invocation") .emit(); } } @@ -5857,7 +5856,7 @@ impl<'a> Parser<'a> { if self.eat_keyword(keywords::Mut) { let last_span = self.last_span; self.diagnostic().struct_span_err(last_span, "const globals cannot be mutable") - .fileline_help(last_span, "did you mean to declare a static?") + .help("did you mean to declare a static?") .emit(); } let (ident, item_, extra_attrs) = self.parse_item_const(None)?; |
