Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/libsyntax/ext/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,11 @@ fn expand_annotatable(mut item: Annotatable, fld: &mut MacroExpander) -> SmallVe
};

fld.cx.bt_pop();
modified.into_iter().flat_map(|it| expand_annotatable(it, fld)).collect()
let configured = modified.into_iter().flat_map(|it| {
it.fold_with(&mut fld.strip_unconfigured())
}).collect::<SmallVector<_>>();

configured.into_iter().flat_map(|it| expand_annotatable(it, fld)).collect()
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ fn expand_into_foo_multi(cx: &mut ExtCtxt,
..(*quote_item!(cx, enum Foo2 { Bar2, Baz2 }).unwrap()).clone()
})),
Annotatable::Item(quote_item!(cx, enum Foo3 { Bar }).unwrap()),
Annotatable::Item(quote_item!(cx, #[cfg(any())] fn foo2() {}).unwrap()),
],
Annotatable::ImplItem(it) => vec![
quote_item!(cx, impl X { fn foo(&self) -> i32 { 42 } }).unwrap().and_then(|i| {
Expand Down
3 changes: 3 additions & 0 deletions src/test/run-pass-fulldeps/macro-crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ extern crate macro_crate_test;
#[derive(PartialEq, Clone, Debug)]
fn foo() -> AnotherFakeTypeThatHadBetterGoAway {}

// Check that the `#[into_multi_foo]`-generated `foo2` is configured away
fn foo2() {}

trait Qux {
#[into_multi_foo]
fn bar();
Expand Down