diff options
| author | Ivan Radanov Ivanov <ivanradanov@yahoo.co.uk> | 2015-02-24 16:07:54 +0200 |
|---|---|---|
| committer | Ivan Radanov Ivanov <ivanradanov@yahoo.co.uk> | 2015-03-03 15:18:33 +0200 |
| commit | 7496539a00b36d86620699576bc7c82ce03dca7e (patch) | |
| tree | 81fbd8303dab0e7168e664201d52cdd83ebbd916 /src/libsyntax/parse | |
| parent | 24a840d4897f0853cb034e5a1b51fb28cd450f11 (diff) | |
| download | rust-7496539a00b36d86620699576bc7c82ce03dca7e.tar.gz rust-7496539a00b36d86620699576bc7c82ce03dca7e.zip | |
Change span_help calls to fileline_help where appropriate
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/attr.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/lexer/mod.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 15 |
4 files changed, 12 insertions, 9 deletions
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index a0e2b4dbf5a..db5583cf13a 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -77,7 +77,7 @@ impl<'a> ParserAttr for Parser<'a> { self.span_err(span, "an inner attribute is not permitted in \ this context"); - self.span_help(span, + self.fileline_help(span, "place inner attribute at the top of the module or block"); } ast::AttrInner diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 83d2bb0cc70..31716ef243a 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -772,7 +772,7 @@ impl<'a> StringReader<'a> { self.span_diagnostic .span_warn(sp, "\\U00ABCD12 and \\uABCD escapes are deprecated"); self.span_diagnostic - .span_help(sp, "use \\u{ABCD12} escapes instead"); + .fileline_help(sp, "use \\u{ABCD12} escapes instead"); } /// Scan for a single (possibly escaped) byte or char diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 4d099529cb4..95ed4880a5b 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -722,7 +722,7 @@ pub fn integer_lit(s: &str, suffix: Option<&str>, sd: &SpanHandler, sp: Span) -> &suf[1..])); } else { sd.span_err(sp, &*format!("illegal suffix `{}` for numeric literal", suf)); - sd.span_help(sp, "the suffix must be one of the integral types \ + sd.fileline_help(sp, "the suffix must be one of the integral types \ (`u32`, `isize`, etc)"); } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index c1acee57cf8..6ec3cc5394d 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -973,7 +973,7 @@ impl<'a> Parser<'a> { } pub fn span_fatal_help(&self, sp: Span, m: &str, help: &str) -> ! { self.span_err(sp, m); - self.span_help(sp, help); + self.fileline_help(sp, help); panic!(diagnostic::FatalError); } pub fn span_note(&self, sp: Span, m: &str) { @@ -982,6 +982,9 @@ impl<'a> Parser<'a> { pub fn span_help(&self, sp: Span, m: &str) { self.sess.span_diagnostic.span_help(sp, m) } + pub fn fileline_help(&self, sp: Span, m: &str) { + self.sess.span_diagnostic.fileline_help(sp, m) + } pub fn bug(&self, m: &str) -> ! { self.sess.span_diagnostic.span_bug(self.span, m) } @@ -2531,7 +2534,7 @@ impl<'a> Parser<'a> { Some(f) => f, None => continue, }; - self.span_help(last_span, + self.fileline_help(last_span, &format!("try parenthesizing the first index; e.g., `(foo.{}){}`", float.trunc() as usize, &float.fract().to_string()[1..])); @@ -2942,7 +2945,7 @@ impl<'a> Parser<'a> { self.span_err(op_span, "chained comparison operators require parentheses"); if op.node == BiLt && outer_op == BiGt { - self.span_help(op_span, + self.fileline_help(op_span, "use `::<...>` instead of `<...>` if you meant to specify type arguments"); } } @@ -4698,7 +4701,7 @@ impl<'a> Parser<'a> { match visa { Public => { self.span_err(span, "can't qualify macro invocation with `pub`"); - self.span_help(span, "try adjusting the macro to put `pub` inside \ + self.fileline_help(span, "try adjusting the macro to put `pub` inside \ the invocation"); } Inherited => (), @@ -5435,7 +5438,7 @@ impl<'a> Parser<'a> { if self.token.is_ident() { self.bump(); } self.span_err(span, "expected `;`, found `as`"); - self.span_help(span, + self.fileline_help(span, &format!("perhaps you meant to enclose the crate name `{}` in \ a string?", the_ident.as_str())); @@ -5746,7 +5749,7 @@ impl<'a> Parser<'a> { if self.eat_keyword(keywords::Mut) { let last_span = self.last_span; self.span_err(last_span, "const globals cannot be mutable"); - self.span_help(last_span, "did you mean to declare a static?"); + self.fileline_help(last_span, "did you mean to declare a static?"); } let (ident, item_, extra_attrs) = self.parse_item_const(None); let last_span = self.last_span; |
