@@ -7,7 +7,6 @@ use crate::rustc_middle::ty::TyEncoder;
77use crate :: QueryConfigRestored ;
88use rustc_data_structures:: stable_hasher:: { Hash64 , HashStable , StableHasher } ;
99use rustc_data_structures:: sync:: Lock ;
10- use rustc_errors:: Diagnostic ;
1110
1211use rustc_index:: Idx ;
1312use rustc_middle:: dep_graph:: dep_kinds;
@@ -31,7 +30,6 @@ use rustc_serialize::Encodable;
3130use rustc_session:: Limit ;
3231use rustc_span:: def_id:: LOCAL_CRATE ;
3332use std:: num:: NonZeroU64 ;
34- use thin_vec:: ThinVec ;
3533
3634#[ derive( Copy , Clone ) ]
3735pub struct QueryCtxt < ' tcx > {
@@ -127,7 +125,7 @@ impl QueryContext for QueryCtxt<'_> {
127125 self ,
128126 token : QueryJobId ,
129127 depth_limit : bool ,
130- diagnostics : Option < & Lock < ThinVec < Diagnostic > > > ,
128+ side_effects : Option < & Lock < QuerySideEffects > > ,
131129 compute : impl FnOnce ( ) -> R ,
132130 ) -> R {
133131 // The `TyCtxt` stored in TLS has the same global interner lifetime
@@ -142,7 +140,7 @@ impl QueryContext for QueryCtxt<'_> {
142140 let new_icx = ImplicitCtxt {
143141 tcx : self . tcx ,
144142 query : Some ( token) ,
145- diagnostics ,
143+ side_effects ,
146144 query_depth : current_icx. query_depth + depth_limit as usize ,
147145 task_deps : current_icx. task_deps ,
148146 } ;
@@ -174,6 +172,16 @@ impl QueryContext for QueryCtxt<'_> {
174172 crate_name : self . crate_name ( LOCAL_CRATE ) ,
175173 } ) ;
176174 }
175+
176+ #[ tracing:: instrument( level = "trace" , skip( self ) ) ]
177+ fn apply_side_effects ( self , side_effects : QuerySideEffects ) {
178+ let dcx = self . dep_context ( ) . sess ( ) . dcx ( ) ;
179+ let QuerySideEffects { diagnostics } = side_effects;
180+
181+ for diagnostic in diagnostics {
182+ dcx. emit_diagnostic ( diagnostic) ;
183+ }
184+ }
177185}
178186
179187pub ( super ) fn try_mark_green < ' tcx > ( tcx : TyCtxt < ' tcx > , dep_node : & dep_graph:: DepNode ) -> bool {
0 commit comments