From 3bb9efb6b70445076858ab72bebbbd7e31347307 Mon Sep 17 00:00:00 2001 From: Yilin Chen Date: Sun, 21 Mar 2021 23:02:01 +0800 Subject: use the included file as the source of expanded include macro Signed-off-by: Yilin Chen --- crates/hir_ty/src/tests/macros.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'crates/hir_ty/src/tests') diff --git a/crates/hir_ty/src/tests/macros.rs b/crates/hir_ty/src/tests/macros.rs index c1e605740..12951fb16 100644 --- a/crates/hir_ty/src/tests/macros.rs +++ b/crates/hir_ty/src/tests/macros.rs @@ -606,6 +606,29 @@ fn bar() -> u32 {0} ); } +#[test] +fn infer_builtin_macros_include_child_mod() { + check_types( + r#" +//- /main.rs +#[rustc_builtin_macro] +macro_rules! include {() => {}} + +include!("f/foo.rs"); + +fn main() { + bar::bar(); +} //^ u32 + +//- /f/foo.rs +pub mod bar; + +//- /f/bar.rs +pub fn bar() -> u32 {0} +"#, + ); +} + #[test] fn infer_builtin_macros_include_str() { check_types( -- cgit v1.2.3