Skip to content

Commit 8edd1bf

Browse files
committed
---
yaml --- r: 11698 b: refs/heads/master c: 19c651f h: refs/heads/master v: v3
1 parent 889e0fd commit 8edd1bf

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 6224fdcd08bf94f0410e804ff8f144fc5494ec6d
2+
refs/heads/master: 19c651f4a18597b72113777a9122fc1f2a1ac6bb
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/rustc/syntax/parse/parser.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,21 @@ fn parse_ret_ty(p: parser) -> (ast::ret_style, @ast::ty) {
416416
}
417417
}
418418

419+
fn parse_region(p: parser) -> ast::region {
420+
alt p.token {
421+
token::IDENT(sid, _) if p.look_ahead(1u) == token::DOT {
422+
let string = p.get_str(sid);
423+
p.bump(); p.bump();
424+
if string == "self" {
425+
ast::re_self
426+
} else {
427+
ast::re_named(string)
428+
}
429+
}
430+
_ { ast::re_inferred }
431+
}
432+
}
433+
419434
fn parse_ty(p: parser, colons_before_params: bool) -> @ast::ty {
420435
let lo = p.span.lo;
421436

@@ -467,6 +482,11 @@ fn parse_ty(p: parser, colons_before_params: bool) -> @ast::ty {
467482
let t = ast::ty_vec(parse_mt(p));
468483
expect(p, token::RBRACKET);
469484
t
485+
} else if p.token == token::BINOP(token::AND) {
486+
p.bump();
487+
let region = parse_region(p);
488+
let mt = parse_mt(p);
489+
ast::ty_rptr(region, mt)
470490
} else if eat_word(p, "fn") {
471491
let proto = parse_fn_ty_proto(p);
472492
alt proto {

0 commit comments

Comments
 (0)