Auto merge of #113154 - lcnr:better-probe-check, r=compiler-errors

change snapshot tracking in fulfillment contexts

use the exact snapshot number to prevent misuse even when created inside of a snapshot
This commit is contained in:
bors 2023-07-01 01:53:10 +00:00
commit 7383ab7378
23 changed files with 79 additions and 121 deletions

View file

@ -1984,7 +1984,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
.copied()
.filter(|&(impl_, _)| {
infcx.probe(|_| {
let ocx = ObligationCtxt::new_in_snapshot(&infcx);
let ocx = ObligationCtxt::new(&infcx);
ocx.register_obligations(obligations.clone());
let impl_substs = infcx.fresh_substs_for_item(span, impl_);

View file

@ -161,7 +161,7 @@ impl<'a, 'tcx> Autoderef<'a, 'tcx> {
&self,
ty: Ty<'tcx>,
) -> Option<(Ty<'tcx>, Vec<traits::PredicateObligation<'tcx>>)> {
let mut fulfill_cx = <dyn TraitEngine<'tcx>>::new_in_snapshot(self.infcx);
let mut fulfill_cx = <dyn TraitEngine<'tcx>>::new(self.infcx);
let cause = traits::ObligationCause::misc(self.span, self.body_id);
let normalized_ty = match self

View file

@ -1328,7 +1328,7 @@ fn suggest_impl_trait<'tcx>(
{
continue;
}
let ocx = ObligationCtxt::new_in_snapshot(&infcx);
let ocx = ObligationCtxt::new(&infcx);
let item_ty = ocx.normalize(
&ObligationCause::misc(span, def_id),
param_env,