diff options
| author | bors <bors@rust-lang.org> | 2016-04-15 14:51:16 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-04-15 14:51:16 -0700 |
| commit | 576229fea054105f1f3a49ca5f31f5f4983f5266 (patch) | |
| tree | 736d1a8f05d181f27e51d53ef49e4d77e05bb861 /src/libsyntax | |
| parent | 9debf51f4b8a5d437df1abca57c5a58c45297b60 (diff) | |
| parent | e563359396928453db81141bf12dae04a567f2e9 (diff) | |
Auto merge of #33005 - Manishearth:rollup, r=Manishearth
Rollup of 11 pull requests - Successful merges: #32923, #32926, #32929, #32931, #32935, #32945, #32946, #32964, #32970, #32973, #32997 - Failed merges:
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 17 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 1 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 4 |
3 files changed, 12 insertions, 10 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 8550617560d..cd7b0fcfb00 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -504,6 +504,13 @@ pub fn expand_item_mac(it: P<ast::Item>, /// Expand a stmt fn expand_stmt(stmt: Stmt, fld: &mut MacroExpander) -> SmallVector<Stmt> { + // perform all pending renames + let stmt = { + let pending_renames = &mut fld.cx.syntax_env.info().pending_renames; + let mut rename_fld = IdentRenamer{renames:pending_renames}; + rename_fld.fold_stmt(stmt).expect_one("rename_fold didn't return one value") + }; + let (mac, style, attrs) = match stmt.node { StmtKind::Mac(mac, style, attrs) => (mac, style, attrs), _ => return expand_non_macro_stmt(stmt, fld) @@ -717,14 +724,8 @@ pub fn expand_block(blk: P<Block>, fld: &mut MacroExpander) -> P<Block> { pub fn expand_block_elts(b: P<Block>, fld: &mut MacroExpander) -> P<Block> { b.map(|Block {id, stmts, expr, rules, span}| { let new_stmts = stmts.into_iter().flat_map(|x| { - // perform all pending renames - let renamed_stmt = { - let pending_renames = &mut fld.cx.syntax_env.info().pending_renames; - let mut rename_fld = IdentRenamer{renames:pending_renames}; - rename_fld.fold_stmt(x).expect_one("rename_fold didn't return one value") - }; - // expand macros in the statement - fld.fold_stmt(renamed_stmt).into_iter() + // perform pending renames and expand macros in the statement + fld.fold_stmt(x).into_iter() }).collect(); let new_expr = expr.map(|x| { let expr = { diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 77bae4cb3f6..87ab3dad50c 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -1014,6 +1014,7 @@ fn is_in_follow(_: &ExtCtxt, tok: &Token, frag: &str) -> Result<bool, String> { match *tok { OpenDelim(token::DelimToken::Brace) | OpenDelim(token::DelimToken::Bracket) | Comma | FatArrow | Colon | Eq | Gt | Semi | BinOp(token::Or) => Ok(true), + MatchNt(_, ref frag, _, _) if frag.name.as_str() == "block" => Ok(true), Ident(i, _) if (i.name.as_str() == "as" || i.name.as_str() == "where") => Ok(true), _ => Ok(false) diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index fc18ef407ab..24a62a3dc2a 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -45,8 +45,8 @@ use std::cmp; // The version numbers here correspond to the version in which the current status // was set. This is most important for knowing when a particular feature became // stable (active). -// NB: The featureck.py script parses this information directly out of the source -// so take care when modifying it. +// NB: The tidy tool parses this information directly out of the source so take +// care when modifying it. const KNOWN_FEATURES: &'static [(&'static str, &'static str, Option<u32>, Status)] = &[ ("globs", "1.0.0", None, Accepted), ("macro_rules", "1.0.0", None, Accepted), |
