@@ -693,6 +693,7 @@ impl TypeOwnerId {
693
693
Some ( match self {
694
694
TypeOwnerId :: FunctionId ( it) => GenericDefId :: FunctionId ( it) ,
695
695
TypeOwnerId :: ConstId ( it) => GenericDefId :: ConstId ( it) ,
696
+ TypeOwnerId :: StaticId ( it) => GenericDefId :: StaticId ( it) ,
696
697
TypeOwnerId :: AdtId ( it) => GenericDefId :: AdtId ( it) ,
697
698
TypeOwnerId :: TraitId ( it) => GenericDefId :: TraitId ( it) ,
698
699
TypeOwnerId :: TraitAliasId ( it) => GenericDefId :: TraitAliasId ( it) ,
@@ -701,7 +702,7 @@ impl TypeOwnerId {
701
702
TypeOwnerId :: EnumVariantId ( it) => {
702
703
GenericDefId :: AdtId ( AdtId :: EnumId ( it. lookup ( db) . parent ) )
703
704
}
704
- TypeOwnerId :: InTypeConstId ( _) | TypeOwnerId :: StaticId ( _ ) => return None ,
705
+ TypeOwnerId :: InTypeConstId ( _) => return None ,
705
706
} )
706
707
}
707
708
}
@@ -743,6 +744,7 @@ impl From<GenericDefId> for TypeOwnerId {
743
744
GenericDefId :: TypeAliasId ( it) => it. into ( ) ,
744
745
GenericDefId :: ImplId ( it) => it. into ( ) ,
745
746
GenericDefId :: ConstId ( it) => it. into ( ) ,
747
+ GenericDefId :: StaticId ( it) => it. into ( ) ,
746
748
}
747
749
}
748
750
}
@@ -851,7 +853,7 @@ impl GeneralConstId {
851
853
pub fn generic_def ( self , db : & dyn DefDatabase ) -> Option < GenericDefId > {
852
854
match self {
853
855
GeneralConstId :: ConstId ( it) => Some ( it. into ( ) ) ,
854
- GeneralConstId :: StaticId ( _ ) => None ,
856
+ GeneralConstId :: StaticId ( it ) => Some ( it . into ( ) ) ,
855
857
GeneralConstId :: ConstBlockId ( it) => it. lookup ( db) . parent . as_generic_def_id ( db) ,
856
858
GeneralConstId :: InTypeConstId ( it) => it. lookup ( db) . owner . as_generic_def_id ( db) ,
857
859
}
@@ -897,7 +899,7 @@ impl DefWithBodyId {
897
899
pub fn as_generic_def_id ( self , db : & dyn DefDatabase ) -> Option < GenericDefId > {
898
900
match self {
899
901
DefWithBodyId :: FunctionId ( f) => Some ( f. into ( ) ) ,
900
- DefWithBodyId :: StaticId ( _ ) => None ,
902
+ DefWithBodyId :: StaticId ( s ) => Some ( s . into ( ) ) ,
901
903
DefWithBodyId :: ConstId ( c) => Some ( c. into ( ) ) ,
902
904
DefWithBodyId :: VariantId ( c) => Some ( c. lookup ( db) . parent . into ( ) ) ,
903
905
// FIXME: stable rust doesn't allow generics in constants, but we should
@@ -927,18 +929,23 @@ pub enum GenericDefId {
927
929
ConstId ( ConstId ) ,
928
930
FunctionId ( FunctionId ) ,
929
931
ImplId ( ImplId ) ,
932
+ // can't actually have generics currently, but they might in the future
933
+ // More importantly, this completes the set of items that contain type references
934
+ // which is to be used by the signature expression store in the future.
935
+ StaticId ( StaticId ) ,
930
936
TraitAliasId ( TraitAliasId ) ,
931
937
TraitId ( TraitId ) ,
932
938
TypeAliasId ( TypeAliasId ) ,
933
939
}
934
940
impl_from ! (
935
- FunctionId ,
936
941
AdtId ( StructId , EnumId , UnionId ) ,
937
- TraitId ,
938
- TraitAliasId ,
939
- TypeAliasId ,
942
+ ConstId ,
943
+ FunctionId ,
940
944
ImplId ,
941
- ConstId
945
+ StaticId ,
946
+ TraitAliasId ,
947
+ TraitId ,
948
+ TypeAliasId
942
949
for GenericDefId
943
950
) ;
944
951
@@ -969,6 +976,7 @@ impl GenericDefId {
969
976
GenericDefId :: TraitAliasId ( it) => file_id_and_params_of_item_loc ( db, it) ,
970
977
GenericDefId :: ImplId ( it) => file_id_and_params_of_item_loc ( db, it) ,
971
978
GenericDefId :: ConstId ( it) => ( it. lookup ( db) . id . file_id ( ) , None ) ,
979
+ GenericDefId :: StaticId ( it) => ( it. lookup ( db) . id . file_id ( ) , None ) ,
972
980
}
973
981
}
974
982
@@ -1350,6 +1358,7 @@ impl HasModule for GenericDefId {
1350
1358
GenericDefId :: TypeAliasId ( it) => it. module ( db) ,
1351
1359
GenericDefId :: ImplId ( it) => it. module ( db) ,
1352
1360
GenericDefId :: ConstId ( it) => it. module ( db) ,
1361
+ GenericDefId :: StaticId ( it) => it. module ( db) ,
1353
1362
}
1354
1363
}
1355
1364
}
0 commit comments