From 735056e898c25afb3778644634cc685c1ade7d5e Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Wed, 18 Nov 2020 19:20:22 +0100 Subject: [PATCH] Fix test failure due to rust-lang/rust#72493 See https://github.com/rust-lang/rust/pull/72493 --- rust-toolchain | 2 +- src/typeck.rs | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/rust-toolchain b/rust-toolchain index 39968240..32c0cdfb 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2020-06-23 +nightly-2020-06-24 diff --git a/src/typeck.rs b/src/typeck.rs index 91a16b4f..f6108767 100644 --- a/src/typeck.rs +++ b/src/typeck.rs @@ -221,13 +221,17 @@ impl<'a, 'tcx> TypeComparisonContext<'a, 'tcx> { use rustc_infer::infer::{InferOk, RegionckMode}; use rustc_middle::ty::Lift; - let error = self - .infcx - .at(&ObligationCause::dummy(), target_param_env) - .eq(orig, target) - .map(|InferOk { obligations: o, .. }| { - assert_eq!(o, vec![]); - }); + let error = self.infcx.commit_if_ok(|snapshot| { + let select = self + .infcx + .at(&ObligationCause::dummy(), target_param_env) + .eq(orig, target) + .map(|InferOk { obligations: o, .. }| { + assert_eq!(o, vec![]); + }); + let leak_check = self.infcx.leak_check(false, snapshot); + select.and(leak_check) + }); if let Err(err) = error { let outlives_env = OutlivesEnvironment::new(target_param_env);