Skip to content

Commit ef0bc46

Browse files
committed
auto merge of #19778 : aochagavia/rust/ice, r=alexcrichton
Fixes #19734
2 parents b677746 + 8788cb0 commit ef0bc46

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

src/libsyntax/ext/expand.rs

+10-9
Original file line numberDiff line numberDiff line change
@@ -1021,16 +1021,17 @@ fn expand_method(m: P<ast::Method>, fld: &mut MacroExpander) -> SmallVector<P<as
10211021
|meths, mark| meths.move_map(|m| mark_method(m, mark)),
10221022
fld);
10231023

1024-
let new_methods = match maybe_new_methods {
1025-
Some(methods) => methods,
1024+
match maybe_new_methods {
1025+
Some(methods) => {
1026+
// expand again if necessary
1027+
let new_methods = methods.into_iter()
1028+
.flat_map(|m| fld.fold_method(m).into_iter())
1029+
.collect();
1030+
fld.cx.bt_pop();
1031+
new_methods
1032+
}
10261033
None => SmallVector::zero()
1027-
};
1028-
1029-
// expand again if necessary
1030-
let new_methods = new_methods.into_iter()
1031-
.flat_map(|m| fld.fold_method(m).into_iter()).collect();
1032-
fld.cx.bt_pop();
1033-
new_methods
1034+
}
10341035
}
10351036
})
10361037
}

src/test/compile-fail/issue-19734.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {}
12+
13+
impl Type {
14+
undef!() //~ ERROR macro undefined: 'undef!'
15+
}

0 commit comments

Comments
 (0)