mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Builtin derives are hygienic
This commit is contained in:
parent
af40101841
commit
7dd9f20ce3
8 changed files with 112 additions and 159 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue