From 9c14eaac36e24bb2098d68873649c11729002be1 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Mon, 11 Apr 2022 23:44:34 +0900 Subject: [PATCH] Rustup to rust-lang/rust#91318 --- rust-toolchain | 2 +- src/translate.rs | 18 +++++++++--------- src/typeck.rs | 15 ++++++++------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/rust-toolchain b/rust-toolchain index 6da8c4e2..7960b3a1 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,4 +1,4 @@ # NOTE: Keep in sync with nightly date on README [toolchain] -channel = "nightly-2021-11-30" +channel = "nightly-2021-12-05" components = ["llvm-tools-preview", "rustc-dev"] diff --git a/src/translate.rs b/src/translate.rs index 8c5e7273..1cb186d3 100644 --- a/src/translate.rs +++ b/src/translate.rs @@ -166,7 +166,7 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> { use rustc_middle::ty::TypeAndMut; use rustc_middle::ty::{AdtDef, Binder, ExistentialProjection, ExistentialTraitRef}; - let Ok(result) = orig.fold_with(&mut BottomUpFolder { + let result = orig.fold_with(&mut BottomUpFolder { tcx: self.tcx, ty_op: |ty| { match *ty.kind() { @@ -559,12 +559,12 @@ impl<'a, 'tcx> TypeFolder<'tcx> for InferenceCleanupFolder<'a, 'tcx> { self.infcx.tcx } - fn fold_ty(&mut self, ty: Ty<'tcx>) -> Result, Self::Error> { + fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> { use rustc_middle::ty::TyKind; use rustc_middle::ty::TypeAndMut; - let t1 = ty.super_fold_with(self)?; - Ok(match *t1.kind() { + let t1 = ty.super_fold_with(self); + match *t1.kind() { TyKind::Ref(region, ty, mutbl) if region.needs_infer() => { let ty_and_mut = TypeAndMut { ty, mutbl }; self.infcx @@ -573,15 +573,15 @@ impl<'a, 'tcx> TypeFolder<'tcx> for InferenceCleanupFolder<'a, 'tcx> { } TyKind::Infer(_) => self.infcx.tcx.ty_error(), _ => t1, - }) + } } - fn fold_region(&mut self, r: Region<'tcx>) -> Result, Self::Error> { - let r1 = r.super_fold_with(self)?; - Ok(if r1.needs_infer() { + fn fold_region(&mut self, r: Region<'tcx>) -> Region<'tcx> { + let r1 = r.super_fold_with(self); + if r1.needs_infer() { self.infcx.tcx.lifetimes.re_erased } else { r1 - }) + } } } diff --git a/src/typeck.rs b/src/typeck.rs index a2159d74..88dd2890 100644 --- a/src/typeck.rs +++ b/src/typeck.rs @@ -254,11 +254,12 @@ impl<'a, 'tcx> TypeComparisonContext<'a, 'tcx> { RegionckMode::default(), ); - let Ok(folded) = self + let err = self .infcx .resolve_vars_if_possible(err) - .fold_with(&mut self.folder.clone()); - let err = folded.lift_to_tcx(lift_tcx).unwrap(); + .fold_with(&mut self.folder.clone()) + .lift_to_tcx(lift_tcx) + .unwrap(); Some(err) } else { @@ -287,11 +288,11 @@ impl<'a, 'tcx> TypeComparisonContext<'a, 'tcx> { errors .iter() .map(|err| { - let Ok(folded) = self - .infcx + self.infcx .resolve_vars_if_possible(err.obligation.predicate) - .fold_with(&mut self.folder.clone()); - folded.lift_to_tcx(lift_tcx).unwrap() + .fold_with(&mut self.folder.clone()) + .lift_to_tcx(lift_tcx) + .unwrap() }) .collect() })