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 Original file line number Diff line number Diff line change @@ -528,3 +528,65 @@ fn f() {$0
528
528
"# ] ] ,
529
529
)
530
530
}
531
+
532
+ #[ test]
533
+ fn resolve_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
+ fn shadow_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
+ }
You can’t perform that action at this time.
0 commit comments