Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit719eee2

Browse files
committed
test: add tests for extern preludes resolving in local mods
1 parentea2a16c commit719eee2

File tree

1 file changed

+62
-0
lines changed
  • src/tools/rust-analyzer/crates/hir-def/src/body/tests

1 file changed

+62
-0
lines changed

‎src/tools/rust-analyzer/crates/hir-def/src/body/tests/block.rs‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,3 +528,65 @@ fn f() {$0
528528
"#]],
529529
)
530530
}
531+
532+
#[test]
533+
fnresolve_extern_prelude_in_block(){
534+
check_at(
535+
r#"
536+
//- /main.rs crate:main deps:core
537+
fn main() {
538+
mod f {
539+
use core::S;
540+
$0
541+
}
542+
}
543+
544+
//- /core.rs crate:core
545+
pub struct S;
546+
"#,
547+
expect![[r#"
548+
block scope
549+
f: t
550+
551+
block scope::f
552+
S: ti vi
553+
554+
crate
555+
main: v
556+
"#]],
557+
)
558+
}
559+
560+
#[test]
561+
fnshadow_extern_prelude_in_block(){
562+
check_at(
563+
r#"
564+
//- /main.rs crate:main deps:core
565+
fn main() {
566+
mod core { pub struct S; }
567+
{
568+
fn inner() {} // forces a block def map
569+
use core::S; // should resolve to the local one
570+
$0
571+
}
572+
}
573+
574+
//- /core.rs crate:core
575+
pub const S;
576+
"#,
577+
expect![[r#"
578+
block scope
579+
S: ti vi
580+
inner: v
581+
582+
block scope
583+
core: t
584+
585+
block scope::core
586+
S: t v
587+
588+
crate
589+
main: v
590+
"#]],
591+
)
592+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp