diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index a697d332d16af..414241ee2bfc5 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1026,16 +1026,17 @@ fn expand_method(m: P, fld: &mut MacroExpander) -> SmallVector 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 + } } }) } diff --git a/src/test/compile-fail/issue-19734.rs b/src/test/compile-fail/issue-19734.rs new file mode 100644 index 0000000000000..cee92cae2aa3d --- /dev/null +++ b/src/test/compile-fail/issue-19734.rs @@ -0,0 +1,15 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() {} + +impl Type { + undef!() //~ ERROR macro undefined: 'undef!' +}