about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2021-10-28 13:42:16 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2021-10-28 13:42:16 +0000
commit849b73b8d9f563bfc64ce0e4c311347a4263f258 (patch)
treed317c5d792f3302bf689a0568b8df2a6debe4a17
parentf1a2f2098fb1ad72f315558441b2ef26daf2fe42 (diff)
downloadrust-849b73b8d9f563bfc64ce0e4c311347a4263f258.tar.gz
rust-849b73b8d9f563bfc64ce0e4c311347a4263f258.zip
Manually inline a function that is only ever called at the end of another function
-rw-r--r--compiler/rustc_trait_selection/src/opaque_types.rs39
1 files changed, 6 insertions, 33 deletions
diff --git a/compiler/rustc_trait_selection/src/opaque_types.rs b/compiler/rustc_trait_selection/src/opaque_types.rs
index 197226197d3..02511a7291d 100644
--- a/compiler/rustc_trait_selection/src/opaque_types.rs
+++ b/compiler/rustc_trait_selection/src/opaque_types.rs
@@ -29,15 +29,6 @@ pub trait InferCtxtExt<'tcx> {
         opaque_defn: &OpaqueTypeDecl<'tcx>,
     );
 
-    /*private*/
-    fn generate_member_constraint(
-        &self,
-        concrete_ty: Ty<'tcx>,
-        opaque_defn: &OpaqueTypeDecl<'tcx>,
-        opaque_type_key: OpaqueTypeKey<'tcx>,
-        first_own_region_index: usize,
-    );
-
     fn infer_opaque_definition_from_instantiation(
         &self,
         opaque_type_key: OpaqueTypeKey<'tcx>,
@@ -285,31 +276,13 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
             hir::OpaqueTyOrigin::TyAlias => 0,
         };
 
-        // The regions that appear in the hidden type must be equal to
-        // one of the regions in scope for the opaque type.
-        self.generate_member_constraint(
-            concrete_ty,
-            opaque_defn,
-            opaque_type_key,
-            first_own_region,
-        );
-    }
+        // For a case like `impl Foo<'a, 'b>`, we would generate a constraint
+        // `'r in ['a, 'b, 'static]` for each region `'r` that appears in the
+        // hidden type (i.e., it must be equal to `'a`, `'b`, or `'static`).
+        //
+        // `conflict1` and `conflict2` are the two region bounds that we
+        // detected which were unrelated. They are used for diagnostics.
 
-    /// As a fallback, we sometimes generate an "in constraint". For
-    /// a case like `impl Foo<'a, 'b>`, where `'a` and `'b` cannot be
-    /// related, we would generate a constraint `'r in ['a, 'b,
-    /// 'static]` for each region `'r` that appears in the hidden type
-    /// (i.e., it must be equal to `'a`, `'b`, or `'static`).
-    ///
-    /// `conflict1` and `conflict2` are the two region bounds that we
-    /// detected which were unrelated. They are used for diagnostics.
-    fn generate_member_constraint(
-        &self,
-        concrete_ty: Ty<'tcx>,
-        opaque_defn: &OpaqueTypeDecl<'tcx>,
-        opaque_type_key: OpaqueTypeKey<'tcx>,
-        first_own_region: usize,
-    ) {
         // Create the set of choice regions: each region in the hidden
         // type can be equal to any of the region parameters of the
         // opaque type definition.