Skip to content

Commit b71d2bd

Browse files
committed
rollup merge of rust-lang#19778: aochagavia/ice
Fixes rust-lang#19734
2 parents eb2ce7f + 8788cb0 commit b71d2bd

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
@@ -1026,16 +1026,17 @@ fn expand_method(m: P<ast::Method>, fld: &mut MacroExpander) -> SmallVector<P<as
10261026
|meths, mark| meths.move_map(|m| mark_method(m, mark)),
10271027
fld);
10281028

1029-
let new_methods = match maybe_new_methods {
1030-
Some(methods) => methods,
1029+
match maybe_new_methods {
1030+
Some(methods) => {
1031+
// expand again if necessary
1032+
let new_methods = methods.into_iter()
1033+
.flat_map(|m| fld.fold_method(m).into_iter())
1034+
.collect();
1035+
fld.cx.bt_pop();
1036+
new_methods
1037+
}
10311038
None => SmallVector::zero()
1032-
};
1033-
1034-
// expand again if necessary
1035-
let new_methods = new_methods.into_iter()
1036-
.flat_map(|m| fld.fold_method(m).into_iter()).collect();
1037-
fld.cx.bt_pop();
1038-
new_methods
1039+
}
10391040
}
10401041
})
10411042
}

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)