From 78adc0139cda567c1f3633137e70bd4b23106f4e Mon Sep 17 00:00:00 2001 From: Ali MJ Al-Nasrawy Date: Wed, 3 Aug 2022 12:46:04 +0300 Subject: [PATCH] cosmetic changes --- compiler/rustc_borrowck/src/type_check/mod.rs | 10 ++++++++-- compiler/rustc_borrowck/src/type_check/relate_tys.rs | 6 +++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index 48cf7666f2c8..d32b1edcd8fd 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -2635,10 +2635,16 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { if let Err(_) = self.eq_substs( typeck_root_substs, parent_substs, - Locations::Single(location), + location.to_locations(), ConstraintCategory::BoringNoLocation, ) { - bug!("we shouldn't error, this should only impose region constraints"); + span_mirbug!( + self, + def_id, + "could not relate closure to parent {:?} != {:?}", + typeck_root_substs, + parent_substs + ); } tcx.predicates_of(def_id).instantiate(tcx, substs) diff --git a/compiler/rustc_borrowck/src/type_check/relate_tys.rs b/compiler/rustc_borrowck/src/type_check/relate_tys.rs index 7ccd5da6b919..c97a6a1a6587 100644 --- a/compiler/rustc_borrowck/src/type_check/relate_tys.rs +++ b/compiler/rustc_borrowck/src/type_check/relate_tys.rs @@ -47,12 +47,12 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { locations: Locations, category: ConstraintCategory<'tcx>, ) -> Fallible<()> { - let mut relation = TypeRelating::new( + TypeRelating::new( self.infcx, NllTypeRelatingDelegate::new(self, locations, category, UniverseInfo::other()), ty::Variance::Invariant, - ); - ty::relate::relate_substs(&mut relation, a, b)?; + ) + .relate(a, b)?; Ok(()) } }