libsyntax: Don't ICE on macro invocation in count expr of fixed array type.

This commit is contained in:
Luqman Aden 2014-07-19 00:06:43 -07:00 committed by Alex Crichton
parent 779d100541
commit 445340771d
2 changed files with 23 additions and 2 deletions

View file

@ -536,13 +536,16 @@ fn expand_non_macro_stmt(s: &Stmt, fld: &mut MacroExpander)
} => {
// take it apart:
let Local {
ty: _,
ty: ty,
pat: pat,
init: init,
id: id,
span: span,
source: source,
} = **local;
// expand the ty since TyFixedLengthVec contains an Expr
// and thus may have a macro use
let expanded_ty = fld.fold_ty(ty);
// expand the pat (it might contain macro uses):
let expanded_pat = fld.fold_pat(pat);
// find the PatIdents in the pattern:
@ -566,7 +569,7 @@ fn expand_non_macro_stmt(s: &Stmt, fld: &mut MacroExpander)
let new_init_opt = init.map(|e| fld.fold_expr(e));
let rewritten_local =
box(GC) Local {
ty: local.ty,
ty: expanded_ty,
pat: rewritten_pat,
init: new_init_opt,
id: id,