@@ -7,7 +7,6 @@ use std::num::NonZero;
7
7
use rustc_data_structures:: stable_hasher:: { Hash64 , HashStable , StableHasher } ;
8
8
use rustc_data_structures:: sync:: Lock ;
9
9
use rustc_data_structures:: unord:: UnordMap ;
10
- use rustc_errors:: DiagInner ;
11
10
use rustc_index:: Idx ;
12
11
use rustc_middle:: bug;
13
12
use rustc_middle:: dep_graph:: {
@@ -31,7 +30,6 @@ use rustc_query_system::{LayoutOfDepth, QueryOverflow};
31
30
use rustc_serialize:: { Decodable , Encodable } ;
32
31
use rustc_session:: Limit ;
33
32
use rustc_span:: def_id:: LOCAL_CRATE ;
34
- use thin_vec:: ThinVec ;
35
33
36
34
use crate :: QueryConfigRestored ;
37
35
@@ -127,7 +125,7 @@ impl QueryContext for QueryCtxt<'_> {
127
125
self ,
128
126
token : QueryJobId ,
129
127
depth_limit : bool ,
130
- diagnostics : Option < & Lock < ThinVec < DiagInner > > > ,
128
+ side_effects : Option < & Lock < QuerySideEffects > > ,
131
129
compute : impl FnOnce ( ) -> R ,
132
130
) -> R {
133
131
// The `TyCtxt` stored in TLS has the same global interner lifetime
@@ -142,7 +140,7 @@ impl QueryContext for QueryCtxt<'_> {
142
140
let new_icx = ImplicitCtxt {
143
141
tcx : self . tcx ,
144
142
query : Some ( token) ,
145
- diagnostics ,
143
+ side_effects ,
146
144
query_depth : current_icx. query_depth + depth_limit as usize ,
147
145
task_deps : current_icx. task_deps ,
148
146
} ;
@@ -174,6 +172,16 @@ impl QueryContext for QueryCtxt<'_> {
174
172
crate_name : self . crate_name ( LOCAL_CRATE ) ,
175
173
} ) ;
176
174
}
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
+ }
177
185
}
178
186
179
187
pub ( super ) fn try_mark_green < ' tcx > ( tcx : TyCtxt < ' tcx > , dep_node : & dep_graph:: DepNode ) -> bool {
0 commit comments