Skip to content

Commit

Permalink
Move mir_def_id inside eq_opaque_type_and_type
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Jul 18, 2021
1 parent a002f45 commit 75585b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Expand Up @@ -122,7 +122,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
if let Err(terr) = self.eq_opaque_type_and_type(
mir_output_ty,
normalized_output_ty,
mir_def_id,
Locations::All(output_span),
ConstraintCategory::BoringNoLocation,
) {
Expand All @@ -145,7 +144,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
if let Err(err) = self.eq_opaque_type_and_type(
mir_output_ty,
user_provided_output_ty,
mir_def_id,
Locations::All(output_span),
ConstraintCategory::BoringNoLocation,
) {
Expand Down
11 changes: 5 additions & 6 deletions compiler/rustc_mir/src/borrow_check/type_check/mod.rs
Expand Up @@ -1182,7 +1182,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
}

/// Equates a type `anon_ty` that may contain opaque types whose
/// values are to be inferred by the MIR with def-id `anon_owner_def_id`.
/// values are to be inferred by the MIR.
///
/// The type `revealed_ty` contains the same type as `anon_ty`, but with the
/// hidden types for impl traits revealed.
Expand Down Expand Up @@ -1210,12 +1210,10 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
/// generics of `foo`). Note that `anon_ty` is not just the opaque type,
/// but the entire return type (which may contain opaque types within it).
/// * `revealed_ty` would be `Box<(T, u32)>`
/// * `anon_owner_def_id` would be the def-id of `foo`
fn eq_opaque_type_and_type(
&mut self,
revealed_ty: Ty<'tcx>,
anon_ty: Ty<'tcx>,
anon_owner_def_id: LocalDefId,
locations: Locations,
category: ConstraintCategory,
) -> Fallible<()> {
Expand Down Expand Up @@ -1245,12 +1243,13 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
let tcx = infcx.tcx;
let param_env = self.param_env;
let body = self.body;
let mir_def_id = body.source.def_id().expect_local();

// the "concrete opaque types" maps
let concrete_opaque_types = &tcx.typeck(anon_owner_def_id).concrete_opaque_types;
let concrete_opaque_types = &tcx.typeck(mir_def_id).concrete_opaque_types;
let mut opaque_type_values = VecMap::new();

debug!("eq_opaque_type_and_type: mir_def_id={:?}", body.source.def_id());
debug!("eq_opaque_type_and_type: mir_def_id={:?}", mir_def_id);
let opaque_type_map = self.fully_perform_op(
locations,
category,
Expand All @@ -1268,7 +1267,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
// any generic parameters.)
let (output_ty, opaque_type_map) =
obligations.add(infcx.instantiate_opaque_types(
anon_owner_def_id,
mir_def_id,
dummy_body_id,
param_env,
anon_ty,
Expand Down

0 comments on commit 75585b4

Please sign in to comment.