diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2013-03-27 06:16:28 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2013-04-05 05:36:02 -0400 |
| commit | d28f7344125b47b7e991413c5612708ce8d5ed77 (patch) | |
| tree | 0598b22426dfd8a61972ecd1beb4591983030529 /src/libsyntax/parse/parser.rs | |
| parent | 3333b0f1177fd758cfd95d992aed18972ed26dfb (diff) | |
| download | rust-d28f7344125b47b7e991413c5612708ce8d5ed77.tar.gz rust-d28f7344125b47b7e991413c5612708ce8d5ed77.zip | |
Refactor so that references to traits are not represented using a type with a
bare function store (which is not in fact a kind of value) but rather ty::TraitRef. Removes many uses of fail!() and other telltale signs of type-semantic mismatch. cc #4183 (not a fix, but related)
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 1d780c9b806..3a3597828cd 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2750,8 +2750,8 @@ pub impl Parser { self.bump(); } token::MOD_SEP | token::IDENT(*) => { - let maybe_bound = match *self.token { - token::MOD_SEP => None, + let obsolete_bound = match *self.token { + token::MOD_SEP => false, token::IDENT(copy sid, _) => { match *self.id_to_str(sid) { ~"send" | @@ -2761,27 +2761,18 @@ pub impl Parser { self.obsolete( *self.span, ObsoleteLowerCaseKindBounds); - - // Bogus value, but doesn't matter, since - // is an error - Some(TraitTyParamBound( - self.mk_ty_path(sid))) + self.bump(); + true } - _ => None + _ => false } } _ => fail!() }; - match maybe_bound { - Some(bound) => { - self.bump(); - result.push(bound); - } - None => { - let ty = self.parse_ty(true); - result.push(TraitTyParamBound(ty)); - } + if !obsolete_bound { + let tref = self.parse_trait_ref(); + result.push(TraitTyParamBound(tref)); } } _ => break, |
