@@ -1046,6 +1046,22 @@ impl<'tcx> TyCtxtAt<'tcx> {
1046
1046
name : Symbol ,
1047
1047
def_kind : DefKind ,
1048
1048
) -> 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) ;
1049
1065
// The following call has the side effect of modifying the tables inside `definitions`.
1050
1066
// These very tables are relied on by the incr. comp. engine to decode DepNodes and to
1051
1067
// decode the on-disk cache.
@@ -1060,18 +1076,6 @@ impl<'tcx> TyCtxtAt<'tcx> {
1060
1076
// This is fine because:
1061
1077
// - those queries are `eval_always` so we won't miss their result changing;
1062
1078
// - 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) ;
1075
1079
let def_id = self . untracked . definitions . write ( ) . create_def ( parent, data) ;
1076
1080
1077
1081
// This function modifies `self.definitions` using a side-effect.
@@ -1091,7 +1095,7 @@ impl<'tcx> TyCtxt<'tcx> {
1091
1095
feed. visibility ( ty:: Visibility :: Restricted ( parent_mod) ) ;
1092
1096
}
1093
1097
1094
- def_id
1098
+ feed
1095
1099
}
1096
1100
1097
1101
pub fn iter_local_def_id ( self ) -> impl Iterator < Item = LocalDefId > + ' tcx {
0 commit comments