about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Jasper <mjjasper1@gmail.com>2019-12-26 20:46:38 +0000
committerMatthew Jasper <mjjasper1@gmail.com>2020-02-14 20:12:46 +0000
commit9664122b1ff04dd8a853de602cd64d86a6473248 (patch)
tree7fe489340d61e5aaa18421070739d163b0967e4c
parent43dae91821afd70eeea46bfe0a793321b7e77526 (diff)
downloadrust-9664122b1ff04dd8a853de602cd64d86a6473248.tar.gz
rust-9664122b1ff04dd8a853de602cd64d86a6473248.zip
Simplify function signature in opaque_types
-rw-r--r--src/librustc/infer/opaque_types/mod.rs12
-rw-r--r--src/librustc_typeck/check/writeback.rs2
2 files changed, 5 insertions, 9 deletions
diff --git a/src/librustc/infer/opaque_types/mod.rs b/src/librustc/infer/opaque_types/mod.rs
index 7a45782cd45..1d69f598256 100644
--- a/src/librustc/infer/opaque_types/mod.rs
+++ b/src/librustc/infer/opaque_types/mod.rs
@@ -550,13 +550,13 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
     /// # Parameters
     ///
     /// - `def_id`, the `impl Trait` type
-    /// - `opaque_defn`, the opaque definition created in `instantiate_opaque_types`
+    /// - `substs`, the substs  used to instantiate this opaque type
     /// - `instantiated_ty`, the inferred type C1 -- fully resolved, lifted version of
     ///   `opaque_defn.concrete_ty`
     pub fn infer_opaque_definition_from_instantiation(
         &self,
         def_id: DefId,
-        opaque_defn: &OpaqueTypeDecl<'tcx>,
+        substs: SubstsRef<'tcx>,
         instantiated_ty: Ty<'tcx>,
         span: Span,
     ) -> Ty<'tcx> {
@@ -572,12 +572,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
         // `impl Trait` return type, resulting in the parameters
         // shifting.
         let id_substs = InternalSubsts::identity_for_item(self.tcx, def_id);
-        let map: FxHashMap<GenericArg<'tcx>, GenericArg<'tcx>> = opaque_defn
-            .substs
-            .iter()
-            .enumerate()
-            .map(|(index, subst)| (*subst, id_substs[index]))
-            .collect();
+        let map: FxHashMap<GenericArg<'tcx>, GenericArg<'tcx>> =
+            substs.iter().enumerate().map(|(index, subst)| (*subst, id_substs[index])).collect();
 
         // Convert the type from the function into a type valid outside
         // the function, by replacing invalid regions with 'static,
diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs
index b4798fb67f8..758ce6b5222 100644
--- a/src/librustc_typeck/check/writeback.rs
+++ b/src/librustc_typeck/check/writeback.rs
@@ -444,7 +444,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
             // figures out the concrete type with `U`, but the stored type is with `T`.
             let definition_ty = self.fcx.infer_opaque_definition_from_instantiation(
                 def_id,
-                opaque_defn,
+                opaque_defn.substs,
                 instantiated_ty,
                 span,
             );