@@ -1161,8 +1161,9 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
11611161 // Re-export lists automatically contain constructors when necessary.
11621162 match kind {
11631163 DefKind :: Struct => {
1164- if let Some ( ctor_def_id) = self . get_ctor_def_id ( child_index) {
1165- let ctor_kind = self . get_ctor_kind ( child_index) ;
1164+ if let Some ( ( ctor_def_id, ctor_kind) ) =
1165+ self . get_ctor_def_id_and_kind ( child_index)
1166+ {
11661167 let ctor_res =
11671168 Res :: Def ( DefKind :: Ctor ( CtorOf :: Struct , ctor_kind) , ctor_def_id) ;
11681169 let vis = self . get_visibility ( ctor_def_id. index ) ;
@@ -1174,8 +1175,9 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
11741175 // value namespace, they are reserved for possible future use.
11751176 // It's ok to use the variant's id as a ctor id since an
11761177 // error will be reported on any use of such resolution anyway.
1177- let ctor_def_id = self . get_ctor_def_id ( child_index) . unwrap_or ( def_id) ;
1178- let ctor_kind = self . get_ctor_kind ( child_index) ;
1178+ let ( ctor_def_id, ctor_kind) = self
1179+ . get_ctor_def_id_and_kind ( child_index)
1180+ . unwrap_or ( ( def_id, CtorKind :: Fictive ) ) ;
11791181 let ctor_res =
11801182 Res :: Def ( DefKind :: Ctor ( CtorOf :: Variant , ctor_kind) , ctor_def_id) ;
11811183 let mut vis = self . get_visibility ( ctor_def_id. index ) ;
@@ -1296,6 +1298,13 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
12961298 }
12971299 }
12981300
1301+ fn get_fn_has_self_parameter ( & self , id : DefIndex ) -> bool {
1302+ match self . kind ( id) {
1303+ EntryKind :: AssocFn ( data) => data. decode ( self ) . has_self ,
1304+ _ => false ,
1305+ }
1306+ }
1307+
12991308 fn get_associated_item ( & self , id : DefIndex , sess : & Session ) -> ty:: AssocItem {
13001309 let def_key = self . def_key ( id) ;
13011310 let parent = self . local_def_id ( def_key. parent . unwrap ( ) ) ;
@@ -1326,22 +1335,11 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
13261335 self . root . tables . variances . get ( self , id) . unwrap_or_else ( Lazy :: empty) . decode ( self )
13271336 }
13281337
1329- fn get_ctor_kind ( & self , node_id : DefIndex ) -> CtorKind {
1338+ fn get_ctor_def_id_and_kind ( & self , node_id : DefIndex ) -> Option < ( DefId , CtorKind ) > {
13301339 match self . kind ( node_id) {
1331- EntryKind :: Struct ( data, _) | EntryKind :: Union ( data, _) | EntryKind :: Variant ( data) => {
1332- data. decode ( self ) . ctor_kind
1333- }
1334- _ => CtorKind :: Fictive ,
1335- }
1336- }
1337-
1338- fn get_ctor_def_id ( & self , node_id : DefIndex ) -> Option < DefId > {
1339- match self . kind ( node_id) {
1340- EntryKind :: Struct ( data, _) => {
1341- data. decode ( self ) . ctor . map ( |index| self . local_def_id ( index) )
1342- }
1343- EntryKind :: Variant ( data) => {
1344- data. decode ( self ) . ctor . map ( |index| self . local_def_id ( index) )
1340+ EntryKind :: Struct ( data, _) | EntryKind :: Variant ( data) => {
1341+ let vdata = data. decode ( self ) ;
1342+ vdata. ctor . map ( |index| ( self . local_def_id ( index) , vdata. ctor_kind ) )
13451343 }
13461344 _ => None ,
13471345 }
0 commit comments