@@ -102,6 +102,10 @@ impl TyCtxt<'tcx> {
102102 }
103103}
104104
105+ /// Helper for `TyCtxtEnsure` to avoid a closure.
106+ #[ inline( always) ]
107+ fn noop < T > ( _: & T ) { }
108+
105109macro_rules! query_helper_param_ty {
106110 ( DefId ) => { impl IntoQueryParam <DefId > } ;
107111 ( $K: ty) => { $K } ;
@@ -165,7 +169,7 @@ macro_rules! define_callbacks {
165169 #[ inline( always) ]
166170 pub fn $name( self , key: query_helper_param_ty!( $( $K) * ) ) {
167171 let key = key. into_query_param( ) ;
168- let cached = try_get_cached( self . tcx, & self . tcx. query_caches. $name, & key, |_| { } ) ;
172+ let cached = try_get_cached( self . tcx, & self . tcx. query_caches. $name, & key, noop ) ;
169173
170174 let lookup = match cached {
171175 Ok ( ( ) ) => return ,
@@ -192,9 +196,7 @@ macro_rules! define_callbacks {
192196 pub fn $name( self , key: query_helper_param_ty!( $( $K) * ) ) -> query_stored:: $name<$tcx>
193197 {
194198 let key = key. into_query_param( ) ;
195- let cached = try_get_cached( self . tcx, & self . tcx. query_caches. $name, & key, |value| {
196- value. clone( )
197- } ) ;
199+ let cached = try_get_cached( self . tcx, & self . tcx. query_caches. $name, & key, Clone :: clone) ;
198200
199201 let lookup = match cached {
200202 Ok ( value) => return value,
0 commit comments