@@ -132,8 +132,6 @@ pub fn expand_expr(e: Gc<ast::Expr>, fld: &mut MacroExpander) -> Gc<ast::Expr> {
132
132
ast:: ExprForLoop ( src_pat, src_expr, src_loop_block, opt_ident) => {
133
133
// Expand any interior macros etc.
134
134
// 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) ;
137
135
138
136
let span = e. span ;
139
137
@@ -143,7 +141,7 @@ pub fn expand_expr(e: Gc<ast::Expr>, fld: &mut MacroExpander) -> Gc<ast::Expr> {
143
141
// i => {
144
142
// ['<ident>:] loop {
145
143
// match i.next() {
146
- // None => break,
144
+ // None => break ['<ident>] ,
147
145
// Some(mut value) => {
148
146
// let <src_pat> = value;
149
147
// <src_loop_block>
@@ -163,7 +161,7 @@ pub fn expand_expr(e: Gc<ast::Expr>, fld: &mut MacroExpander) -> Gc<ast::Expr> {
163
161
let local_path = fld. cx . path_ident ( span, local_ident) ;
164
162
let some_path = fld. cx . path_ident ( span, fld. cx . ident_of ( "Some" ) ) ;
165
163
166
- // `None => break ['<ident>]; `
164
+ // `None => break ['<ident>], `
167
165
let none_arm = {
168
166
let break_expr = fld. cx . expr ( span, ast:: ExprBreak ( opt_ident) ) ;
169
167
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> {
222
220
let discrim = fld. cx . expr_mut_addr_of ( span, src_expr) ;
223
221
let i_pattern = fld. cx . pat_ident ( span, local_ident) ;
224
222
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 ( )
226
226
}
227
227
228
228
ast:: ExprLoop ( loop_block, opt_ident) => {
@@ -1248,6 +1248,7 @@ mod test {
1248
1248
1249
1249
// FIXME #9384, match variable hygiene. Should expand into
1250
1250
// fn z() {match 8 {x_1 => {match 9 {x_2 | x_2 => x_2 + x_1}}}}
1251
+ #[ ignore]
1251
1252
#[ test] fn issue_9384 ( ) {
1252
1253
run_renaming_test (
1253
1254
& ( "macro_rules! bad_macro (($ex:expr) => ({match 9 {x | x => x + $ex}}))
0 commit comments