Switch on TyEmpty

Parse -> ! as FnConverging(!)
Add AdjustEmptyToAny coercion to all ! expressions
Some fixes
This commit is contained in:
Andrew Cann 2016-07-22 13:50:04 +08:00
parent 9f9f8567eb
commit 104963c539
11 changed files with 88 additions and 54 deletions

View file

@ -1332,11 +1332,7 @@ impl<'a> Parser<'a> {
/// Parse optional return type [ -> TY ] in function decl
pub fn parse_ret_ty(&mut self) -> PResult<'a, FunctionRetTy> {
if self.eat(&token::RArrow) {
if self.eat(&token::Not) {
Ok(FunctionRetTy::None(self.last_span))
} else {
Ok(FunctionRetTy::Ty(self.parse_ty()?))
}
Ok(FunctionRetTy::Ty(self.parse_ty()?))
} else {
let pos = self.span.lo;
Ok(FunctionRetTy::Default(mk_sp(pos, pos)))