@@ -67,6 +67,7 @@ use rustc_span::symbol::Symbol;
67
67
use rustc_span:: { Span , DUMMY_SP } ;
68
68
use rustc_target:: abi;
69
69
use rustc_target:: spec:: PanicStrategy ;
70
+ use std:: marker:: PhantomData ;
70
71
use std:: ops:: Deref ;
71
72
use std:: path:: PathBuf ;
72
73
use std:: sync:: Arc ;
@@ -76,6 +77,8 @@ pub struct QuerySystem<'tcx> {
76
77
pub extern_providers : Box < ExternProviders > ,
77
78
pub arenas : QueryArenas < ' tcx > ,
78
79
pub caches : QueryCaches < ' tcx > ,
80
+ // Since we erase query value types we tell the typesystem about them with `PhantomData`.
81
+ _phantom_values : QueryPhantomValues < ' tcx > ,
79
82
}
80
83
81
84
impl < ' tcx > QuerySystem < ' tcx > {
@@ -85,6 +88,7 @@ impl<'tcx> QuerySystem<'tcx> {
85
88
extern_providers : Box :: new ( extern_providers) ,
86
89
arenas : Default :: default ( ) ,
87
90
caches : Default :: default ( ) ,
91
+ _phantom_values : Default :: default ( ) ,
88
92
}
89
93
}
90
94
}
@@ -303,6 +307,11 @@ macro_rules! define_callbacks {
303
307
) , ) *
304
308
}
305
309
310
+ #[ derive( Default ) ]
311
+ pub struct QueryPhantomValues <' tcx> {
312
+ $( $( #[ $attr] ) * pub $name: PhantomData <query_values:: $name<' tcx>>, ) *
313
+ }
314
+
306
315
#[ derive( Default ) ]
307
316
pub struct QueryCaches <' tcx> {
308
317
$( $( #[ $attr] ) * pub $name: query_storage:: $name<' tcx>, ) *
0 commit comments