@@ -624,13 +624,24 @@ fn prune_cache_value_obligations<'a, 'gcx, 'tcx>(infcx: &'a InferCtxt<'a, 'gcx,
624
624
/// that `T: Trait` (we may also include some other obligations). This
625
625
/// may or may not be necessary -- in principle, all the obligations
626
626
/// that must be proven to show that `T: Trait` were also returned
627
- /// when the cache was first populated. But there is a vague concern
628
- /// that perhaps someone would not have proven those, but also not
629
- /// have used a snapshot, in which case the cache could remain
630
- /// populated even though `T: Trait` has not been shown. Returning
631
- /// this "paranoid" obligation ensures that, no matter what has come
632
- /// before, if you prove the subobligations, we at least know that `T:
633
- /// Trait` is implemented.
627
+ /// when the cache was first populated. But there are some vague concerns,
628
+ /// and so we take the precatuionary measure of including `T: Trait` in
629
+ /// the result:
630
+ ///
631
+ /// Concern #1. The current setup is fragile. Perhaps someone could
632
+ /// have failed to prove the concerns from when the cache was
633
+ /// populated, but also not have used a snapshot, in which case the
634
+ /// cache could remain populated even though `T: Trait` has not been
635
+ /// shown. In this case, the "other code" is at fault -- when you
636
+ /// project something, you are supposed to either have a snapshot or
637
+ /// else prove all the resulting obligations -- but it's still easy to
638
+ /// get wrong.
639
+ ///
640
+ /// Concern #2. Even within the snapshot, if those original
641
+ /// obligations are not yet proven, then we are able to do projections
642
+ /// that may yet turn out to be wrong. This *may* lead to some sort
643
+ /// of trouble, though we don't have a concrete example of how that
644
+ /// can occur yet. But it seems risky at best.
634
645
fn push_paranoid_cache_value_obligation < ' a , ' gcx , ' tcx > ( infcx : & ' a InferCtxt < ' a , ' gcx , ' tcx > ,
635
646
param_env : ty:: ParamEnv < ' tcx > ,
636
647
projection_ty : ty:: ProjectionTy < ' tcx > ,
0 commit comments