From 4a84c3fb21e3357fb3b82179edd924ceeb84379a Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Wed, 19 May 2021 22:08:34 +0200 Subject: Fix unresolved attribute fallback again --- crates/hir_def/src/nameres/tests/macros.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'crates/hir_def/src/nameres/tests') diff --git a/crates/hir_def/src/nameres/tests/macros.rs b/crates/hir_def/src/nameres/tests/macros.rs index b34ba885d..6eb5f97be 100644 --- a/crates/hir_def/src/nameres/tests/macros.rs +++ b/crates/hir_def/src/nameres/tests/macros.rs @@ -706,6 +706,35 @@ fn builtin_derive_with_unresolved_attributes_fall_back() { assert_eq!(map.modules[map.root].scope.impls().len(), 1); } +#[test] +fn unresolved_attributes_fall_back_track_per_file_moditems() { + // Tests that we track per-file ModItems when ignoring an unresolved attribute. + // Just tracking the `ModItem` leads to `Foo` getting ignored. + + check( + r#" + //- /main.rs crate:main + + mod submod; + + #[unresolved] + struct Foo; + + //- /submod.rs + #[unresolved] + struct Bar; + "#, + expect![[r#" + crate + Foo: t v + submod: t + + crate::submod + Bar: t v + "#]], + ); +} + #[test] fn macro_expansion_overflow() { cov_mark::check!(macro_expansion_overflow); -- cgit v1.2.3