@@ -693,6 +693,7 @@ impl TypeOwnerId {
693693 Some ( match self {
694694 TypeOwnerId :: FunctionId ( it) => GenericDefId :: FunctionId ( it) ,
695695 TypeOwnerId :: ConstId ( it) => GenericDefId :: ConstId ( it) ,
696+ TypeOwnerId :: StaticId ( it) => GenericDefId :: StaticId ( it) ,
696697 TypeOwnerId :: AdtId ( it) => GenericDefId :: AdtId ( it) ,
697698 TypeOwnerId :: TraitId ( it) => GenericDefId :: TraitId ( it) ,
698699 TypeOwnerId :: TraitAliasId ( it) => GenericDefId :: TraitAliasId ( it) ,
@@ -701,7 +702,7 @@ impl TypeOwnerId {
701702 TypeOwnerId :: EnumVariantId ( it) => {
702703 GenericDefId :: AdtId ( AdtId :: EnumId ( it. lookup ( db) . parent ) )
703704 }
704- TypeOwnerId :: InTypeConstId ( _) | TypeOwnerId :: StaticId ( _ ) => return None ,
705+ TypeOwnerId :: InTypeConstId ( _) => return None ,
705706 } )
706707 }
707708}
@@ -743,6 +744,7 @@ impl From<GenericDefId> for TypeOwnerId {
743744 GenericDefId :: TypeAliasId ( it) => it. into ( ) ,
744745 GenericDefId :: ImplId ( it) => it. into ( ) ,
745746 GenericDefId :: ConstId ( it) => it. into ( ) ,
747+ GenericDefId :: StaticId ( it) => it. into ( ) ,
746748 }
747749 }
748750}
@@ -851,7 +853,7 @@ impl GeneralConstId {
851853 pub fn generic_def ( self , db : & dyn DefDatabase ) -> Option < GenericDefId > {
852854 match self {
853855 GeneralConstId :: ConstId ( it) => Some ( it. into ( ) ) ,
854- GeneralConstId :: StaticId ( _ ) => None ,
856+ GeneralConstId :: StaticId ( it ) => Some ( it . into ( ) ) ,
855857 GeneralConstId :: ConstBlockId ( it) => it. lookup ( db) . parent . as_generic_def_id ( db) ,
856858 GeneralConstId :: InTypeConstId ( it) => it. lookup ( db) . owner . as_generic_def_id ( db) ,
857859 }
@@ -897,7 +899,7 @@ impl DefWithBodyId {
897899 pub fn as_generic_def_id ( self , db : & dyn DefDatabase ) -> Option < GenericDefId > {
898900 match self {
899901 DefWithBodyId :: FunctionId ( f) => Some ( f. into ( ) ) ,
900- DefWithBodyId :: StaticId ( _ ) => None ,
902+ DefWithBodyId :: StaticId ( s ) => Some ( s . into ( ) ) ,
901903 DefWithBodyId :: ConstId ( c) => Some ( c. into ( ) ) ,
902904 DefWithBodyId :: VariantId ( c) => Some ( c. lookup ( db) . parent . into ( ) ) ,
903905 // FIXME: stable rust doesn't allow generics in constants, but we should
@@ -927,18 +929,23 @@ pub enum GenericDefId {
927929 ConstId ( ConstId ) ,
928930 FunctionId ( FunctionId ) ,
929931 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 ) ,
930936 TraitAliasId ( TraitAliasId ) ,
931937 TraitId ( TraitId ) ,
932938 TypeAliasId ( TypeAliasId ) ,
933939}
934940impl_from ! (
935- FunctionId ,
936941 AdtId ( StructId , EnumId , UnionId ) ,
937- TraitId ,
938- TraitAliasId ,
939- TypeAliasId ,
942+ ConstId ,
943+ FunctionId ,
940944 ImplId ,
941- ConstId
945+ StaticId ,
946+ TraitAliasId ,
947+ TraitId ,
948+ TypeAliasId
942949 for GenericDefId
943950) ;
944951
@@ -969,6 +976,7 @@ impl GenericDefId {
969976 GenericDefId :: TraitAliasId ( it) => file_id_and_params_of_item_loc ( db, it) ,
970977 GenericDefId :: ImplId ( it) => file_id_and_params_of_item_loc ( db, it) ,
971978 GenericDefId :: ConstId ( it) => ( it. lookup ( db) . id . file_id ( ) , None ) ,
979+ GenericDefId :: StaticId ( it) => ( it. lookup ( db) . id . file_id ( ) , None ) ,
972980 }
973981 }
974982
@@ -1350,6 +1358,7 @@ impl HasModule for GenericDefId {
13501358 GenericDefId :: TypeAliasId ( it) => it. module ( db) ,
13511359 GenericDefId :: ImplId ( it) => it. module ( db) ,
13521360 GenericDefId :: ConstId ( it) => it. module ( db) ,
1361+ GenericDefId :: StaticId ( it) => it. module ( db) ,
13531362 }
13541363 }
13551364}
0 commit comments