Skip to content

Commit f690821

Browse files
committed
review comments
1 parent 0a505a7 commit f690821

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/libsyntax/parse/lexer/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1451,11 +1451,10 @@ impl<'a> StringReader<'a> {
14511451
self.err_span_(
14521452
start_with_quote,
14531453
self.pos,
1454-
"lifetimes can't start with a number",
1454+
"lifetimes cannot start with a number",
14551455
);
14561456
}
14571457

1458-
14591458
return Ok(token::Lifetime(ident));
14601459
}
14611460

@@ -1892,7 +1891,7 @@ fn ident_start(c: Option<char>) -> bool {
18921891
None => return false,
18931892
};
18941893

1895-
(c.is_alphabetic() || c == '_' || (c > '\x7f' && c.is_xid_start()))
1894+
(c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || (c > '\x7f' && c.is_xid_start())
18961895
}
18971896

18981897
fn ident_continue(c: Option<char>) -> bool {
@@ -1901,7 +1900,8 @@ fn ident_continue(c: Option<char>) -> bool {
19011900
None => return false,
19021901
};
19031902

1904-
(c.is_alphabetic() || c.is_numeric() || c == '_' || (c > '\x7f' && c.is_xid_continue()))
1903+
(c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_' ||
1904+
(c > '\x7f' && c.is_xid_continue())
19051905
}
19061906

19071907
#[inline]

src/test/ui/parser/numeric-lifetime.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
struct S<'1> { s: &'1 usize }
2-
//~^ ERROR lifetimes can't start with a number
3-
//~| ERROR lifetimes can't start with a number
2+
//~^ ERROR lifetimes cannot start with a number
3+
//~| ERROR lifetimes cannot start with a number
44
fn main() {
55
// verify that the parse error doesn't stop type checking
66
let x: usize = "";

src/test/ui/parser/numeric-lifetime.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error: lifetimes can't start with a number
1+
error: lifetimes cannot start with a number
22
--> $DIR/numeric-lifetime.rs:1:10
33
|
44
LL | struct S<'1> { s: &'1 usize }
55
| ^^
66

7-
error: lifetimes can't start with a number
7+
error: lifetimes cannot start with a number
88
--> $DIR/numeric-lifetime.rs:1:20
99
|
1010
LL | struct S<'1> { s: &'1 usize }

0 commit comments

Comments
 (0)