diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-03-21 17:29:49 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-03-21 17:31:35 -0700 |
| commit | 94327d00c6a5329e510ae364850fa34cd758b83c (patch) | |
| tree | af3b1490b1b9093e2257c0bf92442717499fe0c9 /src/libsyntax/parse | |
| parent | 02c49b32caaf9ed23a347ede9ea47743717e94d7 (diff) | |
| download | rust-94327d00c6a5329e510ae364850fa34cd758b83c.tar.gz rust-94327d00c6a5329e510ae364850fa34cd758b83c.zip | |
librustc: Replace the `&static` bound with `'static`
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 77 |
1 files changed, 40 insertions, 37 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 95f8afd538a..6c942acc34d 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2704,49 +2704,52 @@ pub impl Parser { let mut result = opt_vec::Empty; loop { - if self.eat(&token::BINOP(token::AND)) { - if self.eat_keyword(&~"static") { - result.push(RegionTyParamBound); - } else { - self.span_err(*self.span, - ~"`&static` is the only permissible \ - region bound here"); + match *self.token { + token::LIFETIME(lifetime) => { + if str::eq_slice(*self.id_to_str(lifetime), "static") { + result.push(RegionTyParamBound); + } else { + self.span_err(*self.span, + ~"`'static` is the only permissible \ + region bound here"); + } + self.bump(); } - } else if is_ident(&*self.token) { - let maybe_bound = match *self.token { - token::IDENT(copy sid, _) => { - match *self.id_to_str(sid) { - ~"send" | - ~"copy" | - ~"const" | - ~"owned" => { - self.obsolete( - *self.span, - ObsoleteLowerCaseKindBounds); - - // Bogus value, but doesn't matter, since - // is an error - Some(TraitTyParamBound( - self.mk_ty_path(sid))) + token::IDENT(*) => { + let maybe_bound = match *self.token { + token::IDENT(copy sid, _) => { + match *self.id_to_str(sid) { + ~"send" | + ~"copy" | + ~"const" | + ~"owned" => { + self.obsolete( + *self.span, + ObsoleteLowerCaseKindBounds); + + // Bogus value, but doesn't matter, since + // is an error + Some(TraitTyParamBound( + self.mk_ty_path(sid))) + } + _ => None } - _ => None } - } - _ => fail!() - }; + _ => fail!() + }; - match maybe_bound { - Some(bound) => { - self.bump(); - result.push(bound); - } - None => { - let ty = self.parse_ty(false); - result.push(TraitTyParamBound(ty)); + match maybe_bound { + Some(bound) => { + self.bump(); + result.push(bound); + } + None => { + let ty = self.parse_ty(false); + result.push(TraitTyParamBound(ty)); + } } } - } else { - break; + _ => break, } if self.eat(&token::BINOP(token::PLUS)) { |
