diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index f45f5e65312c2..6d2256474a3df 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -1451,11 +1451,10 @@ impl<'a> StringReader<'a> { self.err_span_( start_with_quote, self.pos, - "lifetimes can't start with a number", + "lifetimes cannot start with a number", ); } - return Ok(token::Lifetime(ident)); } @@ -1892,7 +1891,7 @@ fn ident_start(c: Option) -> bool { None => return false, }; - (c.is_alphabetic() || c == '_' || (c > '\x7f' && c.is_xid_start())) + (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || (c > '\x7f' && c.is_xid_start()) } fn ident_continue(c: Option) -> bool { @@ -1901,7 +1900,8 @@ fn ident_continue(c: Option) -> bool { None => return false, }; - (c.is_alphabetic() || c.is_numeric() || c == '_' || (c > '\x7f' && c.is_xid_continue())) + (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_' || + (c > '\x7f' && c.is_xid_continue()) } #[inline] diff --git a/src/test/ui/parser/numeric-lifetime.rs b/src/test/ui/parser/numeric-lifetime.rs index 3483975a3cb8e..2d82354c62cca 100644 --- a/src/test/ui/parser/numeric-lifetime.rs +++ b/src/test/ui/parser/numeric-lifetime.rs @@ -1,6 +1,6 @@ struct S<'1> { s: &'1 usize } -//~^ ERROR lifetimes can't start with a number -//~| ERROR lifetimes can't start with a number +//~^ ERROR lifetimes cannot start with a number +//~| ERROR lifetimes cannot start with a number fn main() { // verify that the parse error doesn't stop type checking let x: usize = ""; diff --git a/src/test/ui/parser/numeric-lifetime.stderr b/src/test/ui/parser/numeric-lifetime.stderr index 1bbc508d57d4b..4018b24aac175 100644 --- a/src/test/ui/parser/numeric-lifetime.stderr +++ b/src/test/ui/parser/numeric-lifetime.stderr @@ -1,10 +1,10 @@ -error: lifetimes can't start with a number +error: lifetimes cannot start with a number --> $DIR/numeric-lifetime.rs:1:10 | LL | struct S<'1> { s: &'1 usize } | ^^ -error: lifetimes can't start with a number +error: lifetimes cannot start with a number --> $DIR/numeric-lifetime.rs:1:20 | LL | struct S<'1> { s: &'1 usize }