Skip to content

Commit 43d1938

Browse files
committed
auto merge of #15056 : alexcrichton/rust/issue-15043, r=kballard
The parser already has special logic for parsing `>` tokens from `>>`, and this commit extends the logic to the acquiring a `>` from the `>=` and `>>=` tokens as well. Closes #15043
2 parents 6750eb5 + f0c730b commit 43d1938

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

src/libsyntax/parse/parser.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,16 @@ impl<'a> Parser<'a> {
706706
let lo = span.lo + BytePos(1);
707707
self.replace_token(token::GT, lo, span.hi)
708708
}
709+
token::BINOPEQ(token::SHR) => {
710+
let span = self.span;
711+
let lo = span.lo + BytePos(1);
712+
self.replace_token(token::GE, lo, span.hi)
713+
}
714+
token::GE => {
715+
let span = self.span;
716+
let lo = span.lo + BytePos(1);
717+
self.replace_token(token::EQ, lo, span.hi)
718+
}
709719
_ => {
710720
let gt_str = Parser::token_to_str(&token::GT);
711721
let this_token_str = self.this_token_to_str();
@@ -726,7 +736,9 @@ impl<'a> Parser<'a> {
726736
let mut first = true;
727737
let mut v = Vec::new();
728738
while self.token != token::GT
729-
&& self.token != token::BINOP(token::SHR) {
739+
&& self.token != token::BINOP(token::SHR)
740+
&& self.token != token::GE
741+
&& self.token != token::BINOPEQ(token::SHR) {
730742
match sep {
731743
Some(ref t) => {
732744
if first { first = false; }

src/test/run-pass/issue-15043.rs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![allow(warnings)]
12+
13+
struct S<T>(T);
14+
15+
static s1: S<S<uint>>=S(S(0));
16+
static s2: S<uint>=S(0);
17+
18+
fn main() {
19+
let foo: S<S<uint>>=S(S(0));
20+
let foo: S<uint>=S(0);
21+
}

0 commit comments

Comments
 (0)