aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/nameres/tests/macros.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src/nameres/tests/macros.rs')
-rw-r--r--crates/hir_def/src/nameres/tests/macros.rs74
1 files changed, 74 insertions, 0 deletions
diff --git a/crates/hir_def/src/nameres/tests/macros.rs b/crates/hir_def/src/nameres/tests/macros.rs
index 6eb5f97be..3065efd65 100644
--- a/crates/hir_def/src/nameres/tests/macros.rs
+++ b/crates/hir_def/src/nameres/tests/macros.rs
@@ -736,6 +736,80 @@ fn unresolved_attributes_fall_back_track_per_file_moditems() {
736} 736}
737 737
738#[test] 738#[test]
739fn unresolved_attrs_extern_block_hang() {
740 // Regression test for https://github.com/rust-analyzer/rust-analyzer/issues/8905
741 check(
742 r#"
743#[unresolved]
744extern "C" {
745 #[unresolved]
746 fn f();
747}
748 "#,
749 expect![[r#"
750 crate
751 f: v
752 "#]],
753 );
754}
755
756#[test]
757fn macros_in_extern_block() {
758 check(
759 r#"
760macro_rules! m {
761 () => { static S: u8; };
762}
763
764extern {
765 m!();
766}
767 "#,
768 expect![[r#"
769 crate
770 S: v
771 "#]],
772 );
773}
774
775#[test]
776fn resolves_derive_helper() {
777 cov_mark::check!(resolved_derive_helper);
778 check(
779 r#"
780//- /main.rs crate:main deps:proc
781#[derive(proc::Derive)]
782#[helper]
783#[unresolved]
784struct S;
785
786//- /proc.rs crate:proc
787#[proc_macro_derive(Derive, attributes(helper))]
788fn derive() {}
789 "#,
790 expect![[r#"
791 crate
792 S: t v
793 "#]],
794 );
795}
796
797#[test]
798fn unresolved_attr_with_cfg_attr_hang() {
799 // Another regression test for https://github.com/rust-analyzer/rust-analyzer/issues/8905
800 check(
801 r#"
802#[cfg_attr(not(off), unresolved, unresolved)]
803struct S;
804 "#,
805 expect![[r#"
806 crate
807 S: t v
808 "#]],
809 );
810}
811
812#[test]
739fn macro_expansion_overflow() { 813fn macro_expansion_overflow() {
740 cov_mark::check!(macro_expansion_overflow); 814 cov_mark::check!(macro_expansion_overflow);
741 check( 815 check(