rollup merge of #20425: sanxiyn/opt-local-ty

This avoids having ast::Ty nodes which have no counterpart in the source.
This commit is contained in:
Alex Crichton 2015-01-02 09:23:47 -08:00
commit 6f567e0c29
12 changed files with 50 additions and 28 deletions

View file

@ -3628,13 +3628,9 @@ impl<'a> Parser<'a> {
let lo = self.span.lo;
let pat = self.parse_pat();
let mut ty = P(Ty {
id: ast::DUMMY_NODE_ID,
node: TyInfer,
span: mk_sp(lo, lo),
});
let mut ty = None;
if self.eat(&token::Colon) {
ty = self.parse_ty_sum();
ty = Some(self.parse_ty_sum());
}
let init = self.parse_initializer();
P(ast::Local {