Skip to content

Commit 116271a

Browse files
committed
---
yaml --- r: 121789 b: refs/heads/snap-stage3 c: 1e329bf h: refs/heads/master i: 121787: 818af7a v: v3
1 parent 6878d74 commit 116271a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: d0983872efeea757600031a081a2eff9676fe895
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: d2adb7cf81f565bdacd45190aac5e53cc2e04ea6
4+
refs/heads/snap-stage3: 1e329bf050088281729a2ac8e83bd52f1776363e
55
refs/heads/try: 18dc3bc9e3314a250c0718ab329938e676410cdf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libsyntax/ext/expand.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ pub fn expand_expr(e: Gc<ast::Expr>, fld: &mut MacroExpander) -> Gc<ast::Expr> {
132132
ast::ExprForLoop(src_pat, src_expr, src_loop_block, opt_ident) => {
133133
// Expand any interior macros etc.
134134
// NB: we don't fold pats yet. Curious.
135-
let src_expr = fld.fold_expr(src_expr).clone();
136-
let (src_loop_block, opt_ident) = expand_loop_block(src_loop_block, opt_ident, fld);
137135

138136
let span = e.span;
139137

@@ -143,7 +141,7 @@ pub fn expand_expr(e: Gc<ast::Expr>, fld: &mut MacroExpander) -> Gc<ast::Expr> {
143141
// i => {
144142
// ['<ident>:] loop {
145143
// match i.next() {
146-
// None => break,
144+
// None => break ['<ident>],
147145
// Some(mut value) => {
148146
// let <src_pat> = value;
149147
// <src_loop_block>
@@ -163,7 +161,7 @@ pub fn expand_expr(e: Gc<ast::Expr>, fld: &mut MacroExpander) -> Gc<ast::Expr> {
163161
let local_path = fld.cx.path_ident(span, local_ident);
164162
let some_path = fld.cx.path_ident(span, fld.cx.ident_of("Some"));
165163

166-
// `None => break ['<ident>];`
164+
// `None => break ['<ident>],`
167165
let none_arm = {
168166
let break_expr = fld.cx.expr(span, ast::ExprBreak(opt_ident));
169167
let none_pat = fld.cx.pat_ident(span, none_ident);
@@ -222,7 +220,9 @@ pub fn expand_expr(e: Gc<ast::Expr>, fld: &mut MacroExpander) -> Gc<ast::Expr> {
222220
let discrim = fld.cx.expr_mut_addr_of(span, src_expr);
223221
let i_pattern = fld.cx.pat_ident(span, local_ident);
224222
let arm = fld.cx.arm(span, vec!(i_pattern), loop_expr);
225-
fld.cx.expr_match(span, discrim, vec!(arm))
223+
// why these clone()'s everywhere? I guess I'll follow the pattern....
224+
let match_expr = fld.cx.expr_match(span, discrim, vec!(arm));
225+
fld.fold_expr(match_expr).clone()
226226
}
227227

228228
ast::ExprLoop(loop_block, opt_ident) => {
@@ -1248,6 +1248,7 @@ mod test {
12481248

12491249
// FIXME #9384, match variable hygiene. Should expand into
12501250
// fn z() {match 8 {x_1 => {match 9 {x_2 | x_2 => x_2 + x_1}}}}
1251+
#[ignore]
12511252
#[test] fn issue_9384(){
12521253
run_renaming_test(
12531254
&("macro_rules! bad_macro (($ex:expr) => ({match 9 {x | x => x + $ex}}))

0 commit comments

Comments
 (0)