diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-05-19 21:10:00 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-05-19 21:10:00 +0100 |
commit | 7cb5920372017b81b954705c03d0b24e60c3e223 (patch) | |
tree | be5bb32dfc5a6853843975b98f99ba8de3f059c1 /crates/hir_def/src/nameres/tests | |
parent | 49922cb2c3cd8390891cda9acb88b4b979db8911 (diff) | |
parent | 4a84c3fb21e3357fb3b82179edd924ceeb84379a (diff) |
Merge #8888
8888: fix: fix unresolved attribute fallback again r=jonas-schievink a=jonas-schievink
`ModItem`s are per-file, so we have to track the file if we store them in the crate-level `DefCollector`.
Fixes the remaining issue in https://github.com/rust-analyzer/rust-analyzer/pull/8882#issuecomment-844379170
bors r+
Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/hir_def/src/nameres/tests')
-rw-r--r-- | crates/hir_def/src/nameres/tests/macros.rs | 29 |
1 files changed, 29 insertions, 0 deletions
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 | |||
@@ -707,6 +707,35 @@ fn builtin_derive_with_unresolved_attributes_fall_back() { | |||
707 | } | 707 | } |
708 | 708 | ||
709 | #[test] | 709 | #[test] |
710 | fn unresolved_attributes_fall_back_track_per_file_moditems() { | ||
711 | // Tests that we track per-file ModItems when ignoring an unresolved attribute. | ||
712 | // Just tracking the `ModItem` leads to `Foo` getting ignored. | ||
713 | |||
714 | check( | ||
715 | r#" | ||
716 | //- /main.rs crate:main | ||
717 | |||
718 | mod submod; | ||
719 | |||
720 | #[unresolved] | ||
721 | struct Foo; | ||
722 | |||
723 | //- /submod.rs | ||
724 | #[unresolved] | ||
725 | struct Bar; | ||
726 | "#, | ||
727 | expect![[r#" | ||
728 | crate | ||
729 | Foo: t v | ||
730 | submod: t | ||
731 | |||
732 | crate::submod | ||
733 | Bar: t v | ||
734 | "#]], | ||
735 | ); | ||
736 | } | ||
737 | |||
738 | #[test] | ||
710 | fn macro_expansion_overflow() { | 739 | fn macro_expansion_overflow() { |
711 | cov_mark::check!(macro_expansion_overflow); | 740 | cov_mark::check!(macro_expansion_overflow); |
712 | check( | 741 | check( |