mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Implment include macro
This commit is contained in:
parent
d75577fcee
commit
0a06c7e6e6
4 changed files with 107 additions and 19 deletions
|
@ -438,6 +438,51 @@ fn main() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn infer_builtin_macros_include() {
|
||||
let (db, pos) = TestDB::with_position(
|
||||
r#"
|
||||
//- /main.rs
|
||||
#[rustc_builtin_macro]
|
||||
macro_rules! include {() => {}}
|
||||
|
||||
include!("foo.rs");
|
||||
|
||||
fn main() {
|
||||
bar()<|>;
|
||||
}
|
||||
|
||||
//- /foo.rs
|
||||
fn bar() -> u32 {0}
|
||||
"#,
|
||||
);
|
||||
assert_eq!("u32", type_at_pos(&db, pos));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn infer_builtin_macros_include_concat() {
|
||||
let (db, pos) = TestDB::with_position(
|
||||
r#"
|
||||
//- /main.rs
|
||||
#[rustc_builtin_macro]
|
||||
macro_rules! include {() => {}}
|
||||
|
||||
#[rustc_builtin_macro]
|
||||
macro_rules! concat {() => {}}
|
||||
|
||||
include!(concat!("f", "oo.rs"));
|
||||
|
||||
fn main() {
|
||||
bar()<|>;
|
||||
}
|
||||
|
||||
//- /foo.rs
|
||||
fn bar() -> u32 {0}
|
||||
"#,
|
||||
);
|
||||
assert_eq!("u32", type_at_pos(&db, pos));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn infer_builtin_macros_concat_with_lazy() {
|
||||
assert_snapshot!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue