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 <sticnarf@gmail.com>
This commit is contained in:
bors[bot] 2021-03-21 17:57:45 +00:00 committed by GitHub
commit 31ed164161
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 108 additions and 30 deletions

View file

@ -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(