Builtin derives are hygienic

This commit is contained in:
Lukas Wirth 2024-01-08 10:37:09 +01:00
parent af40101841
commit 7dd9f20ce3
8 changed files with 112 additions and 159 deletions

View file

@ -987,15 +987,12 @@ fn infer_builtin_macros_env() {
fn infer_builtin_macros_option_env() {
check_types(
r#"
//- minicore: option
//- /main.rs env:foo=bar
#[rustc_builtin_macro]
macro_rules! option_env {() => {}}
fn main() {
let x = option_env!("foo");
//^ Option<&str>
}
//- minicore: env
//- /main.rs env:foo=bar
fn main() {
let x = option_env!("foo");
//^ Option<&str>
}
"#,
);
}
@ -1014,6 +1011,21 @@ fn test() {
);
}
#[test]
fn infer_builtin_derive_resolves_with_core_module() {
check_types(
r#"
//- minicore: derive, clone
mod core {}
#[derive(Clone)]
struct S;
fn test() {
S.clone();
} //^^^^^^^^^ S
"#,
);
}
#[test]
fn infer_derive_clone_with_params() {
check_types(