about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-11-03 15:28:54 -0800
committerAlex Crichton <alex@alexcrichton.com>2014-11-03 15:28:54 -0800
commit59d47a3ca4bfc3c1b1ff6f46f23bef7874146604 (patch)
tree1d90f5ae7f6e75aef57c0cef6e9ccb7e734a4f48 /src/libsyntax
parentb11b706545ec986b0416a14383170c60004644a5 (diff)
parent5bf9ef2122e2d9c872ea551d0561c9326940446f (diff)
downloadrust-59d47a3ca4bfc3c1b1ff6f46f23bef7874146604.tar.gz
rust-59d47a3ca4bfc3c1b1ff6f46f23bef7874146604.zip
rollup merge of #18132 : P1start/more-help
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/bytes.rs4
-rw-r--r--src/libsyntax/feature_gate.rs2
-rw-r--r--src/libsyntax/parse/parser.rs19
3 files changed, 17 insertions, 8 deletions
diff --git a/src/libsyntax/ext/bytes.rs b/src/libsyntax/ext/bytes.rs
index a93295815e0..2d1d13f16d0 100644
--- a/src/libsyntax/ext/bytes.rs
+++ b/src/libsyntax/ext/bytes.rs
@@ -22,10 +22,10 @@ pub fn expand_syntax_ext<'cx>(cx: &'cx mut ExtCtxt,
                               tts: &[ast::TokenTree])
                               -> Box<base::MacResult+'cx> {
     cx.span_warn(sp, "`bytes!` is deprecated, use `b\"foo\"` literals instead");
-    cx.parse_sess.span_diagnostic.span_note(sp,
+    cx.parse_sess.span_diagnostic.span_help(sp,
         "see http://doc.rust-lang.org/reference.html#byte-and-byte-string-literals \
          for documentation");
-    cx.parse_sess.span_diagnostic.span_note(sp,
+    cx.parse_sess.span_diagnostic.span_help(sp,
         "see https://github.com/rust-lang/rust/blob/master/src/etc/2014-06-rewrite-bytes-macros.py \
          for an automated migration");
 
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 54eaa308658..330e4552e2f 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -131,7 +131,7 @@ impl<'a> Context<'a> {
     fn gate_feature(&self, feature: &str, span: Span, explain: &str) {
         if !self.has_feature(feature) {
             self.span_handler.span_err(span, explain);
-            self.span_handler.span_note(span, format!("add #![feature({})] to the \
+            self.span_handler.span_help(span, format!("add #![feature({})] to the \
                                                        crate attributes to enable",
                                                       feature).as_slice());
         }
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index aa3b9668d46..5e18c6bae48 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -2371,10 +2371,19 @@ impl<'a> Parser<'a> {
                   token::LitFloat(n) => {
                     self.bump();
                     let last_span = self.last_span;
+                    let fstr = n.as_str();
                     self.span_err(last_span,
                                   format!("unexpected token: `{}`", n.as_str()).as_slice());
-                    self.span_note(last_span,
-                                   "try parenthesizing the first index; e.g., `(foo.0).1`");
+                    if fstr.chars().all(|x| "0123456789.".contains_char(x)) {
+                        let float = match from_str::<f64>(fstr) {
+                            Some(f) => f,
+                            None => continue,
+                        };
+                        self.span_help(last_span,
+                            format!("try parenthesizing the first index; e.g., `(foo.{}){}`",
+                                    float.trunc() as uint,
+                                    float.fract().to_string()[1..]).as_slice());
+                    }
                     self.abort_if_errors();
 
                   }
@@ -2578,7 +2587,7 @@ impl<'a> Parser<'a> {
             token::Eof => {
                 let open_braces = self.open_braces.clone();
                 for sp in open_braces.iter() {
-                    self.span_note(*sp, "Did you mean to close this delimiter?");
+                    self.span_help(*sp, "did you mean to close this delimiter?");
                 }
                 // There shouldn't really be a span, but it's easier for the test runner
                 // if we give it one
@@ -5352,8 +5361,8 @@ impl<'a> Parser<'a> {
             self.bump();
             if self.eat_keyword(keywords::Mut) {
                 let last_span = self.last_span;
-                self.span_err(last_span, "const globals cannot be mutable, \
-                                          did you mean to declare a static?");
+                self.span_err(last_span, "const globals cannot be mutable");
+                self.span_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;