diff options
Diffstat (limited to 'crates/hir_ty/src/tests/macros.rs')
-rw-r--r-- | crates/hir_ty/src/tests/macros.rs | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/crates/hir_ty/src/tests/macros.rs b/crates/hir_ty/src/tests/macros.rs index 7647bb08b..d14103aab 100644 --- a/crates/hir_ty/src/tests/macros.rs +++ b/crates/hir_ty/src/tests/macros.rs | |||
@@ -982,14 +982,18 @@ fn test() { | |||
982 | } //^ S | 982 | } //^ S |
983 | 983 | ||
984 | //- /lib.rs crate:core | 984 | //- /lib.rs crate:core |
985 | #[prelude_import] | 985 | pub mod prelude { |
986 | use clone::*; | 986 | pub mod rust_2018 { |
987 | mod clone { | 987 | #[rustc_builtin_macro] |
988 | trait Clone { | 988 | pub macro Clone {} |
989 | pub use crate::clone::Clone; | ||
990 | } | ||
991 | } | ||
992 | |||
993 | pub mod clone { | ||
994 | pub trait Clone { | ||
989 | fn clone(&self) -> Self; | 995 | fn clone(&self) -> Self; |
990 | } | 996 | } |
991 | #[rustc_builtin_macro] | ||
992 | macro Clone {} | ||
993 | } | 997 | } |
994 | "#, | 998 | "#, |
995 | ); | 999 | ); |
@@ -1001,14 +1005,22 @@ fn infer_derive_clone_in_core() { | |||
1001 | r#" | 1005 | r#" |
1002 | //- /lib.rs crate:core | 1006 | //- /lib.rs crate:core |
1003 | #[prelude_import] | 1007 | #[prelude_import] |
1004 | use clone::*; | 1008 | use prelude::rust_2018::*; |
1005 | mod clone { | 1009 | |
1006 | trait Clone { | 1010 | pub mod prelude { |
1011 | pub mod rust_2018 { | ||
1012 | #[rustc_builtin_macro] | ||
1013 | pub macro Clone {} | ||
1014 | pub use crate::clone::Clone; | ||
1015 | } | ||
1016 | } | ||
1017 | |||
1018 | pub mod clone { | ||
1019 | pub trait Clone { | ||
1007 | fn clone(&self) -> Self; | 1020 | fn clone(&self) -> Self; |
1008 | } | 1021 | } |
1009 | #[rustc_builtin_macro] | ||
1010 | macro Clone {} | ||
1011 | } | 1022 | } |
1023 | |||
1012 | #[derive(Clone)] | 1024 | #[derive(Clone)] |
1013 | pub struct S; | 1025 | pub struct S; |
1014 | 1026 | ||
@@ -1037,14 +1049,18 @@ fn test() { | |||
1037 | } | 1049 | } |
1038 | 1050 | ||
1039 | //- /lib.rs crate:core | 1051 | //- /lib.rs crate:core |
1040 | #[prelude_import] | 1052 | pub mod prelude { |
1041 | use clone::*; | 1053 | pub mod rust_2018 { |
1042 | mod clone { | 1054 | #[rustc_builtin_macro] |
1043 | trait Clone { | 1055 | pub macro Clone {} |
1056 | pub use crate::clone::Clone; | ||
1057 | } | ||
1058 | } | ||
1059 | |||
1060 | pub mod clone { | ||
1061 | pub trait Clone { | ||
1044 | fn clone(&self) -> Self; | 1062 | fn clone(&self) -> Self; |
1045 | } | 1063 | } |
1046 | #[rustc_builtin_macro] | ||
1047 | macro Clone {} | ||
1048 | } | 1064 | } |
1049 | "#, | 1065 | "#, |
1050 | ); | 1066 | ); |