about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJonas Hietala <tradet.h@gmail.com>2014-08-29 09:18:05 +0200
committerJonas Hietala <tradet.h@gmail.com>2014-08-29 10:36:43 +0200
commit5bf1b03e5c8753680c231ebcb7735a9855de31a3 (patch)
tree423f3c02b52696e22775ffa9e753ec1032619cb6 /src
parentdee8423531bf88752e14ebfbdc2c1d1ade8a8fa7 (diff)
downloadrust-5bf1b03e5c8753680c231ebcb7735a9855de31a3.tar.gz
rust-5bf1b03e5c8753680c231ebcb7735a9855de31a3.zip
Tweak error message for use of a keyword in ident position.
Closes #15358
Diffstat (limited to 'src')
-rw-r--r--src/doc/guide.md2
-rw-r--r--src/libsyntax/parse/parser.rs2
-rw-r--r--src/test/compile-fail/bad-value-ident-false.rs2
-rw-r--r--src/test/compile-fail/bad-value-ident-true.rs2
-rw-r--r--src/test/compile-fail/keyword-super.rs2
-rw-r--r--src/test/compile-fail/keyword.rs2
-rw-r--r--src/test/compile-fail/removed-syntax-field-let.rs2
-rw-r--r--src/test/compile-fail/removed-syntax-mut-vec-expr.rs2
-rw-r--r--src/test/compile-fail/removed-syntax-mut-vec-ty.rs2
-rw-r--r--src/test/compile-fail/removed-syntax-uniq-mut-expr.rs2
-rw-r--r--src/test/compile-fail/removed-syntax-uniq-mut-ty.rs2
-rw-r--r--src/test/compile-fail/unsized2.rs2
12 files changed, 12 insertions, 12 deletions
diff --git a/src/doc/guide.md b/src/doc/guide.md
index 8a634a083e8..5bd88288caf 100644
--- a/src/doc/guide.md
+++ b/src/doc/guide.md
@@ -630,7 +630,7 @@ In Rust, however, using `let` to introduce a binding is _not_ an expression. The
 following will produce a compile-time error:
 
 ```{ignore}
-let x = (let y = 5i); // found `let` in ident position
+let x = (let y = 5i); // expected identifier, found keyword `let`
 ```
 
 The compiler is telling us here that it was expecting to see the beginning of
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 37bda15ac2c..e53ad42cb8e 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -599,7 +599,7 @@ impl<'a> Parser<'a> {
             let token_str = self.this_token_to_string();
             let span = self.span;
             self.span_err(span,
-                          format!("found `{}` in ident position",
+                          format!("expected identifier, found keyword `{}`",
                                   token_str).as_slice());
         }
     }
diff --git a/src/test/compile-fail/bad-value-ident-false.rs b/src/test/compile-fail/bad-value-ident-false.rs
index 17157623863..ca10bdd9848 100644
--- a/src/test/compile-fail/bad-value-ident-false.rs
+++ b/src/test/compile-fail/bad-value-ident-false.rs
@@ -8,5 +8,5 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn false() { } //~ ERROR found `false` in ident position
+fn false() { } //~ ERROR expected identifier, found keyword `false`
 fn main() { }
diff --git a/src/test/compile-fail/bad-value-ident-true.rs b/src/test/compile-fail/bad-value-ident-true.rs
index 5160471e95c..4508d5219a2 100644
--- a/src/test/compile-fail/bad-value-ident-true.rs
+++ b/src/test/compile-fail/bad-value-ident-true.rs
@@ -8,5 +8,5 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn true() { } //~ ERROR found `true` in ident position
+fn true() { } //~ ERROR expected identifier, found keyword `true`
 fn main() { }
diff --git a/src/test/compile-fail/keyword-super.rs b/src/test/compile-fail/keyword-super.rs
index 0a4ec841bd3..6cbc8aa1ea6 100644
--- a/src/test/compile-fail/keyword-super.rs
+++ b/src/test/compile-fail/keyword-super.rs
@@ -9,5 +9,5 @@
 // except according to those terms.
 
 fn main() {
-    let super: int; //~ ERROR found `super` in ident position
+    let super: int; //~ ERROR expected identifier, found keyword `super`
 }
diff --git a/src/test/compile-fail/keyword.rs b/src/test/compile-fail/keyword.rs
index 2df56a0ab7c..64eac47e69b 100644
--- a/src/test/compile-fail/keyword.rs
+++ b/src/test/compile-fail/keyword.rs
@@ -9,5 +9,5 @@
 // except according to those terms.
 
 pub mod break {
-    //~^ ERROR found `break` in ident position
+    //~^ ERROR expected identifier, found keyword `break`
 }
diff --git a/src/test/compile-fail/removed-syntax-field-let.rs b/src/test/compile-fail/removed-syntax-field-let.rs
index 2b76db4f160..c8711598163 100644
--- a/src/test/compile-fail/removed-syntax-field-let.rs
+++ b/src/test/compile-fail/removed-syntax-field-let.rs
@@ -10,6 +10,6 @@
 
 struct s {
     let foo: (),
-    //~^  ERROR found `let` in ident position
+    //~^  ERROR expected identifier, found keyword `let`
     //~^^ ERROR expected `:`, found `foo`
 }
diff --git a/src/test/compile-fail/removed-syntax-mut-vec-expr.rs b/src/test/compile-fail/removed-syntax-mut-vec-expr.rs
index 9f0cc0107c1..b20da6346f7 100644
--- a/src/test/compile-fail/removed-syntax-mut-vec-expr.rs
+++ b/src/test/compile-fail/removed-syntax-mut-vec-expr.rs
@@ -10,6 +10,6 @@
 
 fn f() {
     let v = [mut 1, 2, 3, 4];
-    //~^  ERROR found `mut` in ident position
+    //~^  ERROR expected identifier, found keyword `mut`
     //~^^ ERROR expected `]`, found `1`
 }
diff --git a/src/test/compile-fail/removed-syntax-mut-vec-ty.rs b/src/test/compile-fail/removed-syntax-mut-vec-ty.rs
index 912952892e4..c5eec2ef6e1 100644
--- a/src/test/compile-fail/removed-syntax-mut-vec-ty.rs
+++ b/src/test/compile-fail/removed-syntax-mut-vec-ty.rs
@@ -9,5 +9,5 @@
 // except according to those terms.
 
 type v = [mut int];
-    //~^  ERROR found `mut` in ident position
+    //~^  ERROR expected identifier, found keyword `mut`
     //~^^ ERROR expected `]`, found `int`
diff --git a/src/test/compile-fail/removed-syntax-uniq-mut-expr.rs b/src/test/compile-fail/removed-syntax-uniq-mut-expr.rs
index f4fc5b696fa..124b3738fab 100644
--- a/src/test/compile-fail/removed-syntax-uniq-mut-expr.rs
+++ b/src/test/compile-fail/removed-syntax-uniq-mut-expr.rs
@@ -10,6 +10,6 @@
 
 fn f() {
     let a_box = box mut 42;
-    //~^  ERROR found `mut` in ident position
+    //~^  ERROR expected identifier, found keyword `mut`
     //~^^ ERROR expected `;`, found `42`
 }
diff --git a/src/test/compile-fail/removed-syntax-uniq-mut-ty.rs b/src/test/compile-fail/removed-syntax-uniq-mut-ty.rs
index a3fc27d8cf2..579bfed1331 100644
--- a/src/test/compile-fail/removed-syntax-uniq-mut-ty.rs
+++ b/src/test/compile-fail/removed-syntax-uniq-mut-ty.rs
@@ -9,5 +9,5 @@
 // except according to those terms.
 
 type mut_box = Box<mut int>;
-    //~^  ERROR found `mut` in ident position
+    //~^  ERROR expected identifier, found keyword `mut`
     //~^^ ERROR expected `,`, found `int`
diff --git a/src/test/compile-fail/unsized2.rs b/src/test/compile-fail/unsized2.rs
index 0c9d05e2988..c5f9e8d5991 100644
--- a/src/test/compile-fail/unsized2.rs
+++ b/src/test/compile-fail/unsized2.rs
@@ -13,5 +13,5 @@
 fn f<X>() {}
 
 pub fn main() {
-    f<type>(); //~ ERROR found `type` in ident position
+    f<type>(); //~ ERROR expected identifier, found keyword `type`
 }