diff options
Diffstat (limited to 'crates/hir_def/src/nameres/tests/macros.rs')
-rw-r--r-- | crates/hir_def/src/nameres/tests/macros.rs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/crates/hir_def/src/nameres/tests/macros.rs b/crates/hir_def/src/nameres/tests/macros.rs index c37f915ab..b34ba885d 100644 --- a/crates/hir_def/src/nameres/tests/macros.rs +++ b/crates/hir_def/src/nameres/tests/macros.rs | |||
@@ -686,6 +686,27 @@ pub trait Clone {} | |||
686 | } | 686 | } |
687 | 687 | ||
688 | #[test] | 688 | #[test] |
689 | fn builtin_derive_with_unresolved_attributes_fall_back() { | ||
690 | // Tests that we still resolve derives after ignoring an unresolved attribute. | ||
691 | cov_mark::check!(unresolved_attribute_fallback); | ||
692 | let map = compute_crate_def_map( | ||
693 | r#" | ||
694 | //- /main.rs crate:main deps:core | ||
695 | use core::Clone; | ||
696 | |||
697 | #[derive(Clone)] | ||
698 | #[unresolved] | ||
699 | struct Foo; | ||
700 | |||
701 | //- /core.rs crate:core | ||
702 | #[rustc_builtin_macro] | ||
703 | pub macro Clone {} | ||
704 | "#, | ||
705 | ); | ||
706 | assert_eq!(map.modules[map.root].scope.impls().len(), 1); | ||
707 | } | ||
708 | |||
709 | #[test] | ||
689 | fn macro_expansion_overflow() { | 710 | fn macro_expansion_overflow() { |
690 | cov_mark::check!(macro_expansion_overflow); | 711 | cov_mark::check!(macro_expansion_overflow); |
691 | check( | 712 | check( |
@@ -842,7 +863,6 @@ fn collects_derive_helpers() { | |||
842 | fn resolve_macro_def() { | 863 | fn resolve_macro_def() { |
843 | check( | 864 | check( |
844 | r#" | 865 | r#" |
845 | //- /lib.rs | ||
846 | pub macro structs($($i:ident),*) { | 866 | pub macro structs($($i:ident),*) { |
847 | $(struct $i { field: u32 } )* | 867 | $(struct $i { field: u32 } )* |
848 | } | 868 | } |