mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
test: add tests for extern preludes resolving in local mods
This commit is contained in:
parent
55db9530eb
commit
48dc20f80d
@ -528,3 +528,65 @@ fn f() {$0
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolve_extern_prelude_in_block() {
|
||||
check_at(
|
||||
r#"
|
||||
//- /main.rs crate:main deps:core
|
||||
fn main() {
|
||||
mod f {
|
||||
use core::S;
|
||||
$0
|
||||
}
|
||||
}
|
||||
|
||||
//- /core.rs crate:core
|
||||
pub struct S;
|
||||
"#,
|
||||
expect![[r#"
|
||||
block scope
|
||||
f: t
|
||||
|
||||
block scope::f
|
||||
S: ti vi
|
||||
|
||||
crate
|
||||
main: v
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn shadow_extern_prelude_in_block() {
|
||||
check_at(
|
||||
r#"
|
||||
//- /main.rs crate:main deps:core
|
||||
fn main() {
|
||||
mod core { pub struct S; }
|
||||
{
|
||||
fn inner() {} // forces a block def map
|
||||
use core::S; // should resolve to the local one
|
||||
$0
|
||||
}
|
||||
}
|
||||
|
||||
//- /core.rs crate:core
|
||||
pub const S;
|
||||
"#,
|
||||
expect![[r#"
|
||||
block scope
|
||||
S: ti vi
|
||||
inner: v
|
||||
|
||||
block scope
|
||||
core: t
|
||||
|
||||
block scope::core
|
||||
S: t v
|
||||
|
||||
crate
|
||||
main: v
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user