@@ -7,7 +7,6 @@ use std::num::NonZero;
77use rustc_data_structures:: stable_hasher:: { Hash64 , HashStable , StableHasher } ;
88use rustc_data_structures:: sync:: Lock ;
99use rustc_data_structures:: unord:: UnordMap ;
10- use rustc_errors:: DiagInner ;
1110use rustc_index:: Idx ;
1211use rustc_middle:: bug;
1312use rustc_middle:: dep_graph:: {
@@ -31,7 +30,6 @@ use rustc_query_system::{LayoutOfDepth, QueryOverflow};
3130use rustc_serialize:: { Decodable , Encodable } ;
3231use rustc_session:: Limit ;
3332use rustc_span:: def_id:: LOCAL_CRATE ;
34- use thin_vec:: ThinVec ;
3533
3634use crate :: QueryConfigRestored ;
3735
@@ -127,7 +125,7 @@ impl QueryContext for QueryCtxt<'_> {
127125 self ,
128126 token : QueryJobId ,
129127 depth_limit : bool ,
130- diagnostics : Option < & Lock < ThinVec < DiagInner > > > ,
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