From bcc9a28734e731d9823bf0d6516176a71f3d4627 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 7 Sep 2019 21:43:41 +0300 Subject: don't cycle when processing macros from prelude in prelude --- crates/ra_hir/src/nameres/tests/macros.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 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 aece1515b..c62152d26 100644 --- a/crates/ra_hir/src/nameres/tests/macros.rs +++ b/crates/ra_hir/src/nameres/tests/macros.rs @@ -248,3 +248,32 @@ fn prelude_is_macro_use() { ⋮Baz: t v "###); } + +#[test] +fn prelude_cycle() { + let map = def_map( + " + //- /lib.rs + #[prelude_import] + use self::prelude::*; + + declare_mod!(); + + mod prelude { + macro_rules! declare_mod { + () => (mod foo {}) + } + } + ", + ); + assert_snapshot!(map, @r###" + ⋮crate + ⋮foo: t + ⋮prelude: t + ⋮ + ⋮crate::prelude + ⋮declare_mod: m + ⋮ + ⋮crate::foo + "###); +} -- cgit v1.2.3