Skip to content

Commit 5efb650

Browse files
committed
Simplify function signature in opaque_types
1 parent a03c403 commit 5efb650

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/librustc/infer/opaque_types/mod.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -552,13 +552,13 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
552552
/// # Parameters
553553
///
554554
/// - `def_id`, the `impl Trait` type
555-
/// - `opaque_defn`, the opaque definition created in `instantiate_opaque_types`
555+
/// - `substs`, the substs used to instantiate this opaque type
556556
/// - `instantiated_ty`, the inferred type C1 -- fully resolved, lifted version of
557557
/// `opaque_defn.concrete_ty`
558558
pub fn infer_opaque_definition_from_instantiation(
559559
&self,
560560
def_id: DefId,
561-
opaque_defn: &OpaqueTypeDecl<'tcx>,
561+
substs: SubstsRef<'tcx>,
562562
instantiated_ty: Ty<'tcx>,
563563
span: Span,
564564
) -> Ty<'tcx> {
@@ -574,12 +574,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
574574
// `impl Trait` return type, resulting in the parameters
575575
// shifting.
576576
let id_substs = InternalSubsts::identity_for_item(self.tcx, def_id);
577-
let map: FxHashMap<GenericArg<'tcx>, GenericArg<'tcx>> = opaque_defn
578-
.substs
579-
.iter()
580-
.enumerate()
581-
.map(|(index, subst)| (*subst, id_substs[index]))
582-
.collect();
577+
let map: FxHashMap<GenericArg<'tcx>, GenericArg<'tcx>> =
578+
substs.iter().enumerate().map(|(index, subst)| (*subst, id_substs[index])).collect();
583579

584580
// Convert the type from the function into a type valid outside
585581
// the function, by replacing invalid regions with 'static,

src/librustc_typeck/check/writeback.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
444444
// figures out the concrete type with `U`, but the stored type is with `T`.
445445
let definition_ty = self.fcx.infer_opaque_definition_from_instantiation(
446446
def_id,
447-
opaque_defn,
447+
opaque_defn.substs,
448448
instantiated_ty,
449449
span,
450450
);

0 commit comments

Comments
 (0)