mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Use a not so dummy implementation of env macro
This commit is contained in:
parent
48bb1c5172
commit
36c7684687
2 changed files with 28 additions and 1 deletions
|
@ -142,7 +142,7 @@ fn env_expand(
|
||||||
_tt: &tt::Subtree,
|
_tt: &tt::Subtree,
|
||||||
) -> Result<tt::Subtree, mbe::ExpandError> {
|
) -> Result<tt::Subtree, mbe::ExpandError> {
|
||||||
// dummy implementation for type-checking purposes
|
// dummy implementation for type-checking purposes
|
||||||
let expanded = quote! { "" };
|
let expanded = quote! { "__RA_UNIMPLEMENTATED__" };
|
||||||
|
|
||||||
Ok(expanded)
|
Ok(expanded)
|
||||||
}
|
}
|
||||||
|
|
|
@ -483,6 +483,33 @@ fn bar() -> u32 {0}
|
||||||
assert_eq!("u32", type_at_pos(&db, pos));
|
assert_eq!("u32", type_at_pos(&db, pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn infer_builtin_macros_include_concat_with_bad_env_should_failed() {
|
||||||
|
let (db, pos) = TestDB::with_position(
|
||||||
|
r#"
|
||||||
|
//- /main.rs
|
||||||
|
#[rustc_builtin_macro]
|
||||||
|
macro_rules! include {() => {}}
|
||||||
|
|
||||||
|
#[rustc_builtin_macro]
|
||||||
|
macro_rules! concat {() => {}}
|
||||||
|
|
||||||
|
#[rustc_builtin_macro]
|
||||||
|
macro_rules! env {() => {}}
|
||||||
|
|
||||||
|
include!(concat!(env!("OUT_DIR"), "/foo.rs"));
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
bar()<|>;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- /foo.rs
|
||||||
|
fn bar() -> u32 {0}
|
||||||
|
"#,
|
||||||
|
);
|
||||||
|
assert_eq!("{unknown}", type_at_pos(&db, pos));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn infer_builtin_macros_concat_with_lazy() {
|
fn infer_builtin_macros_concat_with_lazy() {
|
||||||
assert_snapshot!(
|
assert_snapshot!(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue