]> git.lizzy.rs Git - rust.git/commitdiff
Fix #19734 (ICE)
authorAdolfo Ochagavía <aochagavia92@gmail.com>
Fri, 12 Dec 2014 16:34:28 +0000 (17:34 +0100)
committerAdolfo Ochagavía <aochagavia92@gmail.com>
Fri, 12 Dec 2014 16:34:28 +0000 (17:34 +0100)
src/libsyntax/ext/expand.rs

index a697d332d16afebb09fa8b9d91954ba7471fb24d..414241ee2bfc584035dc94853a17eff2394c0cb8 100644 (file)
@@ -1026,16 +1026,17 @@ fn expand_method(m: P<ast::Method>, fld: &mut MacroExpander) -> SmallVector<P<as
                                  |meths, mark| meths.move_map(|m| mark_method(m, mark)),
                                  fld);
 
-            let new_methods = match maybe_new_methods {
-                Some(methods) => methods,
+            match maybe_new_methods {
+                Some(methods) => {
+                    // expand again if necessary
+                    let new_methods = methods.into_iter()
+                                             .flat_map(|m| fld.fold_method(m).into_iter())
+                                             .collect();
+                    fld.cx.bt_pop();
+                    new_methods
+                }
                 None => SmallVector::zero()
-            };
-
-            // expand again if necessary
-            let new_methods = new_methods.into_iter()
-                                  .flat_map(|m| fld.fold_method(m).into_iter()).collect();
-            fld.cx.bt_pop();
-            new_methods
+            }
         }
     })
 }