From e6ee324b8529df86f330f5240cbb7bb9048fff57 Mon Sep 17 00:00:00 2001 From: JasperDeSutter Date: Thu, 12 Sep 2019 14:41:16 +0200 Subject: add macros with local_inner_macros argument --- crates/ra_hir/src/nameres/tests/macros.rs | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'crates/ra_hir/src/nameres/tests') diff --git a/crates/ra_hir/src/nameres/tests/macros.rs b/crates/ra_hir/src/nameres/tests/macros.rs index 6e0bc437e..bd60f4258 100644 --- a/crates/ra_hir/src/nameres/tests/macros.rs +++ b/crates/ra_hir/src/nameres/tests/macros.rs @@ -93,6 +93,43 @@ fn macro_rules_from_other_crates_are_visible() { "###); } +#[test] +fn macro_rules_export_with_local_inner_macros_are_visible() { + let map = def_map_with_crate_graph( + " + //- /main.rs + foo::structs!(Foo, Bar) + mod bar; + + //- /bar.rs + use crate::*; + + //- /lib.rs + #[macro_export(local_inner_macros)] + macro_rules! structs { + ($($i:ident),*) => { + $(struct $i { field: u32 } )* + } + } + ", + crate_graph! { + "main": ("/main.rs", ["foo"]), + "foo": ("/lib.rs", []), + }, + ); + assert_snapshot!(map, @r###" + ⋮crate + ⋮Bar: t v + ⋮Foo: t v + ⋮bar: t + ⋮ + ⋮crate::bar + ⋮Bar: t v + ⋮Foo: t v + ⋮bar: t + "###); +} + #[test] fn unexpanded_macro_should_expand_by_fixedpoint_loop() { let map = def_map_with_crate_graph( -- cgit v1.2.3