1
Fork 0

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)
This commit is contained in:
Niko Matsakis 2013-03-27 06:16:28 -04:00
parent 3333b0f117
commit d28f734412
46 changed files with 1069 additions and 860 deletions

View file

@ -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,