about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2015-01-13 15:18:55 +1100
committerHuon Wilson <dbau.pp+github@gmail.com>2015-01-25 00:35:06 +1100
commitec790d6fcc426e13431cbb7510c62864515a3ef8 (patch)
treeadce0173abedda482d03d8e2a912a0145f32315b /src/libsyntax/parse/parser.rs
parent2e888d0341e81de1744b257c25b012c2c148f0ba (diff)
downloadrust-ec790d6fcc426e13431cbb7510c62864515a3ef8.tar.gz
rust-ec790d6fcc426e13431cbb7510c62864515a3ef8.zip
Tweak chained comparison errors.
Lower case and give a more precise span: from operator to operator, not
just the last one.
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 15254988ce0..759e5e8229a 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -2882,12 +2882,13 @@ impl<'a> Parser<'a> {
         debug_assert!(ast_util::is_comparison_binop(outer_op));
         match lhs.node {
             ExprBinary(op, _, _) if ast_util::is_comparison_binop(op.node) => {
-                let op_span = self.span;
+                // respan to include both operators
+                let op_span = mk_sp(op.span.lo, self.span.hi);
                 self.span_err(op_span,
-                    "Chained comparison operators require parentheses");
+                    "chained comparison operators require parentheses");
                 if op.node == BiLt && outer_op == BiGt {
                     self.span_help(op_span,
-                        "use ::< instead of < if you meant to specify type arguments");
+                        "use `::<...>` instead of `<...>` if you meant to specify type arguments");
                 }
             }
             _ => {}