about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2021-10-08 17:53:41 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2021-10-08 17:53:41 +0000
commit49b06a2b60d07ad8b10554bcc700d1e1df014104 (patch)
treed7d75d8230177e5ebf0264c06ea1b91c1f4e1d8d
parent597090ee147b957aae81383ec68b33880b6050da (diff)
downloadrust-49b06a2b60d07ad8b10554bcc700d1e1df014104.tar.gz
rust-49b06a2b60d07ad8b10554bcc700d1e1df014104.zip
Directly call relate_types function instead of having a method wrapper
-rw-r--r--compiler/rustc_borrowck/src/type_check/mod.rs13
-rw-r--r--compiler/rustc_borrowck/src/type_check/relate_tys.rs50
2 files changed, 26 insertions, 37 deletions
diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs
index 696f7c9e00f..07eadce1773 100644
--- a/compiler/rustc_borrowck/src/type_check/mod.rs
+++ b/compiler/rustc_borrowck/src/type_check/mod.rs
@@ -1153,19 +1153,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
         .convert_all(data);
     }
 
-    /// Convenient wrapper around `relate_tys::relate_types` -- see
-    /// that fn for docs.
-    fn relate_types(
-        &mut self,
-        a: Ty<'tcx>,
-        v: ty::Variance,
-        b: Ty<'tcx>,
-        locations: Locations,
-        category: ConstraintCategory,
-    ) -> Fallible<()> {
-        relate_tys::relate_types(self, a, v, b, locations, category)
-    }
-
     /// Try to relate `sub <: sup`
     fn sub_types(
         &mut self,
diff --git a/compiler/rustc_borrowck/src/type_check/relate_tys.rs b/compiler/rustc_borrowck/src/type_check/relate_tys.rs
index 1d1c50e3f59..415d1abaa8b 100644
--- a/compiler/rustc_borrowck/src/type_check/relate_tys.rs
+++ b/compiler/rustc_borrowck/src/type_check/relate_tys.rs
@@ -9,30 +9,32 @@ use crate::constraints::OutlivesConstraint;
 use crate::diagnostics::UniverseInfo;
 use crate::type_check::{Locations, TypeChecker};
 
-/// Adds sufficient constraints to ensure that `a R b` where `R` depends on `v`:
-///
-/// - "Covariant" `a <: b`
-/// - "Invariant" `a == b`
-/// - "Contravariant" `a :> b`
-///
-/// N.B., the type `a` is permitted to have unresolved inference
-/// variables, but not the type `b`.
-#[instrument(skip(type_checker), level = "debug")]
-pub(super) fn relate_types<'tcx>(
-    type_checker: &mut TypeChecker<'_, 'tcx>,
-    a: Ty<'tcx>,
-    v: ty::Variance,
-    b: Ty<'tcx>,
-    locations: Locations,
-    category: ConstraintCategory,
-) -> Fallible<()> {
-    TypeRelating::new(
-        type_checker.infcx,
-        NllTypeRelatingDelegate::new(type_checker, locations, category, UniverseInfo::relate(a, b)),
-        v,
-    )
-    .relate(a, b)?;
-    Ok(())
+impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
+    /// Adds sufficient constraints to ensure that `a R b` where `R` depends on `v`:
+    ///
+    /// - "Covariant" `a <: b`
+    /// - "Invariant" `a == b`
+    /// - "Contravariant" `a :> b`
+    ///
+    /// N.B., the type `a` is permitted to have unresolved inference
+    /// variables, but not the type `b`.
+    #[instrument(skip(self), level = "debug")]
+    pub(super) fn relate_types(
+        &mut self,
+        a: Ty<'tcx>,
+        v: ty::Variance,
+        b: Ty<'tcx>,
+        locations: Locations,
+        category: ConstraintCategory,
+    ) -> Fallible<()> {
+        TypeRelating::new(
+            self.infcx,
+            NllTypeRelatingDelegate::new(self, locations, category, UniverseInfo::relate(a, b)),
+            v,
+        )
+        .relate(a, b)?;
+        Ok(())
+    }
 }
 
 struct NllTypeRelatingDelegate<'me, 'bccx, 'tcx> {