@@ -1046,6 +1046,22 @@ impl<'tcx> TyCtxtAt<'tcx> {
10461046 name : Symbol ,
10471047 def_kind : DefKind ,
10481048 ) -> TyCtxtFeed < ' tcx , LocalDefId > {
1049+ let feed = self . tcx . create_def ( parent, name, def_kind) ;
1050+
1051+ feed. def_span ( self . span ) ;
1052+ feed
1053+ }
1054+ }
1055+
1056+ impl < ' tcx > TyCtxt < ' tcx > {
1057+ /// `tcx`-dependent operations performed for every created definition.
1058+ pub fn create_def (
1059+ self ,
1060+ parent : LocalDefId ,
1061+ name : Symbol ,
1062+ def_kind : DefKind ,
1063+ ) -> TyCtxtFeed < ' tcx , LocalDefId > {
1064+ let data = def_kind. def_path_data ( name) ;
10491065 // The following call has the side effect of modifying the tables inside `definitions`.
10501066 // These very tables are relied on by the incr. comp. engine to decode DepNodes and to
10511067 // decode the on-disk cache.
@@ -1060,18 +1076,6 @@ impl<'tcx> TyCtxtAt<'tcx> {
10601076 // This is fine because:
10611077 // - those queries are `eval_always` so we won't miss their result changing;
10621078 // - this write will have happened before these queries are called.
1063- let def_id = self . tcx . create_def ( parent, name, def_kind) ;
1064-
1065- let feed = self . tcx . feed_local_def_id ( def_id) ;
1066- feed. def_span ( self . span ) ;
1067- feed
1068- }
1069- }
1070-
1071- impl < ' tcx > TyCtxt < ' tcx > {
1072- /// `tcx`-dependent operations performed for every created definition.
1073- pub fn create_def ( self , parent : LocalDefId , name : Symbol , def_kind : DefKind ) -> LocalDefId {
1074- let data = def_kind. def_path_data ( name) ;
10751079 let def_id = self . untracked . definitions . write ( ) . create_def ( parent, data) ;
10761080
10771081 // This function modifies `self.definitions` using a side-effect.
@@ -1091,7 +1095,7 @@ impl<'tcx> TyCtxt<'tcx> {
10911095 feed. visibility ( ty:: Visibility :: Restricted ( parent_mod) ) ;
10921096 }
10931097
1094- def_id
1098+ feed
10951099 }
10961100
10971101 pub fn iter_local_def_id ( self ) -> impl Iterator < Item = LocalDefId > + ' tcx {
0 commit comments