diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-21 17:57:45 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-21 17:57:45 +0000 |
commit | 31ed1641615bd57d9f4897dbe93e97f185fc5273 (patch) | |
tree | c1b252604b48d2379c4735b535deaec9489d2d1a /crates/hir_ty/src/tests | |
parent | 35868c4f7dc479dd5f731a2785ec6a203046ea9c (diff) | |
parent | 7b693470c4fc61fff08c435cc3a2a646e88678cb (diff) |
Merge #8134
8134: Correct the paths of submodules from the include! macro r=edwin0cheng a=sticnarf
This PR should fix #7846. It mostly follows the instructions from @edwin0cheng in that issue.
Co-authored-by: Yilin Chen <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/tests')
-rw-r--r-- | crates/hir_ty/src/tests/macros.rs | 23 |
1 files changed, 23 insertions, 0 deletions
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 | |||
@@ -607,6 +607,29 @@ fn bar() -> u32 {0} | |||
607 | } | 607 | } |
608 | 608 | ||
609 | #[test] | 609 | #[test] |
610 | fn infer_builtin_macros_include_child_mod() { | ||
611 | check_types( | ||
612 | r#" | ||
613 | //- /main.rs | ||
614 | #[rustc_builtin_macro] | ||
615 | macro_rules! include {() => {}} | ||
616 | |||
617 | include!("f/foo.rs"); | ||
618 | |||
619 | fn main() { | ||
620 | bar::bar(); | ||
621 | } //^ u32 | ||
622 | |||
623 | //- /f/foo.rs | ||
624 | pub mod bar; | ||
625 | |||
626 | //- /f/bar.rs | ||
627 | pub fn bar() -> u32 {0} | ||
628 | "#, | ||
629 | ); | ||
630 | } | ||
631 | |||
632 | #[test] | ||
610 | fn infer_builtin_macros_include_str() { | 633 | fn infer_builtin_macros_include_str() { |
611 | check_types( | 634 | check_types( |
612 | r#" | 635 | r#" |