@@ -133,6 +133,7 @@ pub struct SelectionContext<'cx, 'tcx> {
133133 /// policy. In essence, canonicalized queries need their errors propagated
134134 /// rather than immediately reported because we do not have accurate spans.
135135 query_mode : TraitQueryMode ,
136+ skip_projection_cache : bool ,
136137}
137138
138139// A stack that walks back up the stack frame.
@@ -221,6 +222,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
221222 intercrate_ambiguity_causes : None ,
222223 allow_negative_impls : false ,
223224 query_mode : TraitQueryMode :: Standard ,
225+ skip_projection_cache : false ,
224226 }
225227 }
226228
@@ -232,6 +234,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
232234 intercrate_ambiguity_causes : None ,
233235 allow_negative_impls : false ,
234236 query_mode : TraitQueryMode :: Standard ,
237+ skip_projection_cache : false ,
235238 }
236239 }
237240
@@ -247,6 +250,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
247250 intercrate_ambiguity_causes : None ,
248251 allow_negative_impls,
249252 query_mode : TraitQueryMode :: Standard ,
253+ skip_projection_cache : false ,
250254 }
251255 }
252256
@@ -262,9 +266,14 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
262266 intercrate_ambiguity_causes : None ,
263267 allow_negative_impls : false ,
264268 query_mode,
269+ skip_projection_cache : false ,
265270 }
266271 }
267272
273+ pub fn skip_projection_cache ( & self ) -> bool {
274+ self . skip_projection_cache
275+ }
276+
268277 /// Enables tracking of intercrate ambiguity causes. These are
269278 /// used in coherence to give improved diagnostics. We don't do
270279 /// this until we detect a coherence error because it can lead to
@@ -379,12 +388,15 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
379388 & mut self ,
380389 obligation : & PredicateObligation < ' tcx > ,
381390 ) -> Result < EvaluationResult , OverflowError > {
382- self . evaluation_probe ( |this| {
391+ let old = std:: mem:: replace ( & mut self . skip_projection_cache , true ) ;
392+ let res = self . evaluation_probe ( |this| {
383393 this. evaluate_predicate_recursively (
384394 TraitObligationStackList :: empty ( & ProvisionalEvaluationCache :: default ( ) ) ,
385395 obligation. clone ( ) ,
386396 )
387- } )
397+ } ) ;
398+ self . skip_projection_cache = old;
399+ res
388400 }
389401
390402 fn evaluation_probe (
0 commit comments