Tweak error message for use of a keyword in ident position.
Closes #15358
This commit is contained in:
parent
dee8423531
commit
5bf1b03e5c
12 changed files with 12 additions and 12 deletions
|
@ -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:
|
following will produce a compile-time error:
|
||||||
|
|
||||||
```{ignore}
|
```{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
|
The compiler is telling us here that it was expecting to see the beginning of
|
||||||
|
|
|
@ -599,7 +599,7 @@ impl<'a> Parser<'a> {
|
||||||
let token_str = self.this_token_to_string();
|
let token_str = self.this_token_to_string();
|
||||||
let span = self.span;
|
let span = self.span;
|
||||||
self.span_err(span,
|
self.span_err(span,
|
||||||
format!("found `{}` in ident position",
|
format!("expected identifier, found keyword `{}`",
|
||||||
token_str).as_slice());
|
token_str).as_slice());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,5 +8,5 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn false() { } //~ ERROR found `false` in ident position
|
fn false() { } //~ ERROR expected identifier, found keyword `false`
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -8,5 +8,5 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn true() { } //~ ERROR found `true` in ident position
|
fn true() { } //~ ERROR expected identifier, found keyword `true`
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -9,5 +9,5 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let super: int; //~ ERROR found `super` in ident position
|
let super: int; //~ ERROR expected identifier, found keyword `super`
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,5 +9,5 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
pub mod break {
|
pub mod break {
|
||||||
//~^ ERROR found `break` in ident position
|
//~^ ERROR expected identifier, found keyword `break`
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,6 @@
|
||||||
|
|
||||||
struct s {
|
struct s {
|
||||||
let foo: (),
|
let foo: (),
|
||||||
//~^ ERROR found `let` in ident position
|
//~^ ERROR expected identifier, found keyword `let`
|
||||||
//~^^ ERROR expected `:`, found `foo`
|
//~^^ ERROR expected `:`, found `foo`
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,6 @@
|
||||||
|
|
||||||
fn f() {
|
fn f() {
|
||||||
let v = [mut 1, 2, 3, 4];
|
let v = [mut 1, 2, 3, 4];
|
||||||
//~^ ERROR found `mut` in ident position
|
//~^ ERROR expected identifier, found keyword `mut`
|
||||||
//~^^ ERROR expected `]`, found `1`
|
//~^^ ERROR expected `]`, found `1`
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,5 +9,5 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
type v = [mut int];
|
type v = [mut int];
|
||||||
//~^ ERROR found `mut` in ident position
|
//~^ ERROR expected identifier, found keyword `mut`
|
||||||
//~^^ ERROR expected `]`, found `int`
|
//~^^ ERROR expected `]`, found `int`
|
||||||
|
|
|
@ -10,6 +10,6 @@
|
||||||
|
|
||||||
fn f() {
|
fn f() {
|
||||||
let a_box = box mut 42;
|
let a_box = box mut 42;
|
||||||
//~^ ERROR found `mut` in ident position
|
//~^ ERROR expected identifier, found keyword `mut`
|
||||||
//~^^ ERROR expected `;`, found `42`
|
//~^^ ERROR expected `;`, found `42`
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,5 +9,5 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
type mut_box = Box<mut int>;
|
type mut_box = Box<mut int>;
|
||||||
//~^ ERROR found `mut` in ident position
|
//~^ ERROR expected identifier, found keyword `mut`
|
||||||
//~^^ ERROR expected `,`, found `int`
|
//~^^ ERROR expected `,`, found `int`
|
||||||
|
|
|
@ -13,5 +13,5 @@
|
||||||
fn f<X>() {}
|
fn f<X>() {}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
f<type>(); //~ ERROR found `type` in ident position
|
f<type>(); //~ ERROR expected identifier, found keyword `type`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue