mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Merge #2455
2455: Add BuiltinShadowMode r=flodiebold a=edwin0cheng This PR try to fix #1905 by introduce an `BuiltinShadowMode` in name resolving functions. cc @flodiebold Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
This commit is contained in:
commit
ec164fbb68
7 changed files with 139 additions and 32 deletions
|
@ -3693,6 +3693,42 @@ fn main() {
|
|||
assert_eq!(t, "Foo");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn not_shadowing_primitive_by_module() {
|
||||
let t = type_at(
|
||||
r#"
|
||||
//- /str.rs
|
||||
fn foo() {}
|
||||
|
||||
//- /main.rs
|
||||
mod str;
|
||||
fn foo() -> &'static str { "" }
|
||||
|
||||
fn main() {
|
||||
foo()<|>;
|
||||
}"#,
|
||||
);
|
||||
assert_eq!(t, "&str");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn not_shadowing_module_by_primitive() {
|
||||
let t = type_at(
|
||||
r#"
|
||||
//- /str.rs
|
||||
fn foo() -> u32 {0}
|
||||
|
||||
//- /main.rs
|
||||
mod str;
|
||||
fn foo() -> &'static str { "" }
|
||||
|
||||
fn main() {
|
||||
str::foo()<|>;
|
||||
}"#,
|
||||
);
|
||||
assert_eq!(t, "u32");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn deref_trait() {
|
||||
let t = type_at(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue