This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +28
-3
lines changed
crates/ide_completion/src Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,8 @@ fn pattern_path_completion(
141
141
| hir:: PathResolution :: SelfType ( _)
142
142
| hir:: PathResolution :: Def ( hir:: ModuleDef :: Adt ( hir:: Adt :: Struct ( _) ) )
143
143
| hir:: PathResolution :: Def ( hir:: ModuleDef :: Adt ( hir:: Adt :: Enum ( _) ) )
144
- | hir:: PathResolution :: Def ( hir:: ModuleDef :: Adt ( hir:: Adt :: Union ( _) ) ) ) => {
144
+ | hir:: PathResolution :: Def ( hir:: ModuleDef :: Adt ( hir:: Adt :: Union ( _) ) )
145
+ | hir:: PathResolution :: Def ( hir:: ModuleDef :: BuiltinType ( _) ) ) => {
145
146
let ty = match res {
146
147
hir:: PathResolution :: TypeParam ( param) => param. ty ( ctx. db ) ,
147
148
hir:: PathResolution :: SelfType ( impl_def) => impl_def. self_ty ( ctx. db ) ,
@@ -158,6 +159,13 @@ fn pattern_path_completion(
158
159
hir:: PathResolution :: Def ( hir:: ModuleDef :: Adt ( hir:: Adt :: Union ( u) ) ) => {
159
160
u. ty ( ctx. db )
160
161
}
162
+ hir:: PathResolution :: Def ( hir:: ModuleDef :: BuiltinType ( ty) ) => {
163
+ let module = match ctx. module {
164
+ Some ( m) => m,
165
+ None => return ,
166
+ } ;
167
+ ty. ty ( ctx. db , module)
168
+ }
161
169
_ => return ,
162
170
} ;
163
171
Original file line number Diff line number Diff line change @@ -493,7 +493,6 @@ fn f(e: MyEnum) {
493
493
494
494
check_empty (
495
495
r#"
496
- #[repr(C)]
497
496
union U {
498
497
i: i32,
499
498
f: f32,
@@ -515,5 +514,23 @@ fn f(u: U) {
515
514
ct C pub const C: i32
516
515
ct D pub const D: i32
517
516
"# ] ] ,
518
- )
517
+ ) ;
518
+
519
+ check_empty (
520
+ r#"
521
+ #[lang = "u32"]
522
+ impl u32 {
523
+ pub const MIN: Self = 0;
524
+ }
525
+
526
+ fn f(v: u32) {
527
+ match v {
528
+ u32::$0
529
+ }
530
+ }
531
+ "# ,
532
+ expect ! [ [ r#"
533
+ ct MIN pub const MIN: Self
534
+ "# ] ] ,
535
+ ) ;
519
536
}
You can’t perform that action at this time.
0 commit comments