Skip to content

Commit 48368c5

Browse files
committed
test: Add test for two restricted keyword cases
1 parent bde5a84 commit 48368c5

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/librustsyntax/parse/parser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,7 @@ fn parse_pat(p: parser) -> @ast::pat {
13951395
subpat = parse_pat(p);
13961396
} else {
13971397
if is_restricted_keyword(p, fieldname) {
1398-
p.fatal("found " + fieldname + " in binding position");
1398+
p.fatal("found `" + fieldname + "` in binding position");
13991399
}
14001400
subpat = @{id: p.get_id(),
14011401
node: ast::pat_ident(fieldpath, none),
@@ -2149,7 +2149,7 @@ fn parse_item_enum(p: parser, attrs: [ast::attribute]) -> @ast::item {
21492149
// Newtype syntax
21502150
if p.token == token::EQ {
21512151
if is_restricted_keyword(p, id) {
2152-
p.fatal("found " + id + " in enum constructor position");
2152+
p.fatal("found `" + id + "` in enum constructor position");
21532153
}
21542154
p.bump();
21552155
let ty = parse_ty(p, false);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// error-pattern:found `let` in binding position
2+
3+
fn main() {
4+
alt true {
5+
{let} { }
6+
}
7+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// error-pattern:found `let` in enum constructor position
2+
3+
fn main() {
4+
enum let = int;
5+
}

0 commit comments

Comments
 (0)