about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAli MJ Al-Nasrawy <alimjalnasrawy@gmail.com>2022-08-03 12:46:04 +0300
committerAli MJ Al-Nasrawy <alimjalnasrawy@gmail.com>2022-08-03 12:46:04 +0300
commit78adc0139cda567c1f3633137e70bd4b23106f4e (patch)
tree01c4d0ed532ae62764e0ccbc1148b8e6fdf8d05d
parent28f24ebe9f1f7a4d1df75b3b48197f022b2df46e (diff)
downloadrust-78adc0139cda567c1f3633137e70bd4b23106f4e.tar.gz
rust-78adc0139cda567c1f3633137e70bd4b23106f4e.zip
cosmetic changes
-rw-r--r--compiler/rustc_borrowck/src/type_check/mod.rs10
-rw-r--r--compiler/rustc_borrowck/src/type_check/relate_tys.rs6
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 48cf7666f2c..d32b1edcd8f 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 7ccd5da6b91..c97a6a1a658 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(())
     }
 }