@@ -67,6 +67,7 @@ use rustc_span::symbol::Symbol;
6767use rustc_span:: { Span , DUMMY_SP } ;
6868use rustc_target:: abi;
6969use rustc_target:: spec:: PanicStrategy ;
70+ use std:: marker:: PhantomData ;
7071use std:: ops:: Deref ;
7172use std:: path:: PathBuf ;
7273use std:: sync:: Arc ;
@@ -76,6 +77,8 @@ pub struct QuerySystem<'tcx> {
7677 pub extern_providers : Box < ExternProviders > ,
7778 pub arenas : QueryArenas < ' tcx > ,
7879 pub caches : QueryCaches < ' tcx > ,
80+ // Since we erase query value types we tell the typesystem about them with `PhantomData`.
81+ _phantom_values : QueryPhantomValues < ' tcx > ,
7982}
8083
8184impl < ' tcx > QuerySystem < ' tcx > {
@@ -85,6 +88,7 @@ impl<'tcx> QuerySystem<'tcx> {
8588 extern_providers : Box :: new ( extern_providers) ,
8689 arenas : Default :: default ( ) ,
8790 caches : Default :: default ( ) ,
91+ _phantom_values : Default :: default ( ) ,
8892 }
8993 }
9094}
@@ -303,6 +307,11 @@ macro_rules! define_callbacks {
303307 ) , ) *
304308 }
305309
310+ #[ derive( Default ) ]
311+ pub struct QueryPhantomValues <' tcx> {
312+ $( $( #[ $attr] ) * pub $name: PhantomData <query_values:: $name<' tcx>>, ) *
313+ }
314+
306315 #[ derive( Default ) ]
307316 pub struct QueryCaches <' tcx> {
308317 $( $( #[ $attr] ) * pub $name: query_storage:: $name<' tcx>, ) *
0 commit comments