@@ -43,6 +43,9 @@ enum QueryModifier {
43
43
/// A cycle error for this query aborting the compilation with a fatal error.
44
44
FatalCycle ,
45
45
46
+ /// A cycle error results in a delay_bug call
47
+ CycleDelayBug ,
48
+
46
49
/// Don't hash the result, instead just mark a query red if it runs
47
50
NoHash ,
48
51
@@ -101,6 +104,8 @@ impl Parse for QueryModifier {
101
104
Ok ( QueryModifier :: LoadCached ( tcx, id, block) )
102
105
} else if modifier == "fatal_cycle" {
103
106
Ok ( QueryModifier :: FatalCycle )
107
+ } else if modifier == "cycle_delay_bug" {
108
+ Ok ( QueryModifier :: CycleDelayBug )
104
109
} else if modifier == "no_hash" {
105
110
Ok ( QueryModifier :: NoHash )
106
111
} else if modifier == "no_force" {
@@ -207,6 +212,9 @@ struct QueryModifiers {
207
212
/// A cycle error for this query aborting the compilation with a fatal error.
208
213
fatal_cycle : bool ,
209
214
215
+ /// A cycle error results in a delay_bug call
216
+ cycle_delay_bug : bool ,
217
+
210
218
/// Don't hash the result, instead just mark a query red if it runs
211
219
no_hash : bool ,
212
220
@@ -226,6 +234,7 @@ fn process_modifiers(query: &mut Query) -> QueryModifiers {
226
234
let mut cache = None ;
227
235
let mut desc = None ;
228
236
let mut fatal_cycle = false ;
237
+ let mut cycle_delay_bug = false ;
229
238
let mut no_hash = false ;
230
239
let mut no_force = false ;
231
240
let mut anon = false ;
@@ -256,6 +265,12 @@ fn process_modifiers(query: &mut Query) -> QueryModifiers {
256
265
}
257
266
fatal_cycle = true ;
258
267
}
268
+ QueryModifier :: CycleDelayBug => {
269
+ if cycle_delay_bug {
270
+ panic ! ( "duplicate modifier `cycle_delay_bug` for query `{}`" , query. name) ;
271
+ }
272
+ cycle_delay_bug = true ;
273
+ }
259
274
QueryModifier :: NoHash => {
260
275
if no_hash {
261
276
panic ! ( "duplicate modifier `no_hash` for query `{}`" , query. name) ;
@@ -287,6 +302,7 @@ fn process_modifiers(query: &mut Query) -> QueryModifiers {
287
302
cache,
288
303
desc,
289
304
fatal_cycle,
305
+ cycle_delay_bug,
290
306
no_hash,
291
307
no_force,
292
308
anon,
@@ -397,6 +413,10 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
397
413
if modifiers. fatal_cycle {
398
414
attributes. push ( quote ! { fatal_cycle } ) ;
399
415
} ;
416
+ // Pass on the cycle_delay_bug modifier
417
+ if modifiers. cycle_delay_bug {
418
+ attributes. push ( quote ! { cycle_delay_bug } ) ;
419
+ } ;
400
420
// Pass on the no_hash modifier
401
421
if modifiers. no_hash {
402
422
attributes. push ( quote ! { no_hash } ) ;
0 commit comments