@@ -102,6 +102,10 @@ impl TyCtxt<'tcx> {
102
102
}
103
103
}
104
104
105
+ /// Helper for `TyCtxtEnsure` to avoid a closure.
106
+ #[ inline( always) ]
107
+ fn noop < T > ( _: & T ) { }
108
+
105
109
macro_rules! query_helper_param_ty {
106
110
( DefId ) => { impl IntoQueryParam <DefId > } ;
107
111
( $K: ty) => { $K } ;
@@ -165,7 +169,7 @@ macro_rules! define_callbacks {
165
169
#[ inline( always) ]
166
170
pub fn $name( self , key: query_helper_param_ty!( $( $K) * ) ) {
167
171
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 ) ;
169
173
170
174
let lookup = match cached {
171
175
Ok ( ( ) ) => return ,
@@ -192,9 +196,7 @@ macro_rules! define_callbacks {
192
196
pub fn $name( self , key: query_helper_param_ty!( $( $K) * ) ) -> query_stored:: $name<$tcx>
193
197
{
194
198
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) ;
198
200
199
201
let lookup = match cached {
200
202
Ok ( value) => return value,
0 commit comments