Skip to content

Commit 75585b4

Browse files
committed
Move mir_def_id inside eq_opaque_type_and_type
1 parent a002f45 commit 75585b4

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

compiler/rustc_mir/src/borrow_check/type_check/input_output.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
122122
if let Err(terr) = self.eq_opaque_type_and_type(
123123
mir_output_ty,
124124
normalized_output_ty,
125-
mir_def_id,
126125
Locations::All(output_span),
127126
ConstraintCategory::BoringNoLocation,
128127
) {
@@ -145,7 +144,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
145144
if let Err(err) = self.eq_opaque_type_and_type(
146145
mir_output_ty,
147146
user_provided_output_ty,
148-
mir_def_id,
149147
Locations::All(output_span),
150148
ConstraintCategory::BoringNoLocation,
151149
) {

compiler/rustc_mir/src/borrow_check/type_check/mod.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
11821182
}
11831183

11841184
/// Equates a type `anon_ty` that may contain opaque types whose
1185-
/// values are to be inferred by the MIR with def-id `anon_owner_def_id`.
1185+
/// values are to be inferred by the MIR.
11861186
///
11871187
/// The type `revealed_ty` contains the same type as `anon_ty`, but with the
11881188
/// hidden types for impl traits revealed.
@@ -1210,12 +1210,10 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
12101210
/// generics of `foo`). Note that `anon_ty` is not just the opaque type,
12111211
/// but the entire return type (which may contain opaque types within it).
12121212
/// * `revealed_ty` would be `Box<(T, u32)>`
1213-
/// * `anon_owner_def_id` would be the def-id of `foo`
12141213
fn eq_opaque_type_and_type(
12151214
&mut self,
12161215
revealed_ty: Ty<'tcx>,
12171216
anon_ty: Ty<'tcx>,
1218-
anon_owner_def_id: LocalDefId,
12191217
locations: Locations,
12201218
category: ConstraintCategory,
12211219
) -> Fallible<()> {
@@ -1245,12 +1243,13 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
12451243
let tcx = infcx.tcx;
12461244
let param_env = self.param_env;
12471245
let body = self.body;
1246+
let mir_def_id = body.source.def_id().expect_local();
12481247

12491248
// the "concrete opaque types" maps
1250-
let concrete_opaque_types = &tcx.typeck(anon_owner_def_id).concrete_opaque_types;
1249+
let concrete_opaque_types = &tcx.typeck(mir_def_id).concrete_opaque_types;
12511250
let mut opaque_type_values = VecMap::new();
12521251

1253-
debug!("eq_opaque_type_and_type: mir_def_id={:?}", body.source.def_id());
1252+
debug!("eq_opaque_type_and_type: mir_def_id={:?}", mir_def_id);
12541253
let opaque_type_map = self.fully_perform_op(
12551254
locations,
12561255
category,
@@ -1268,7 +1267,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
12681267
// any generic parameters.)
12691268
let (output_ty, opaque_type_map) =
12701269
obligations.add(infcx.instantiate_opaque_types(
1271-
anon_owner_def_id,
1270+
mir_def_id,
12721271
dummy_body_id,
12731272
param_env,
12741273
anon_ty,

0 commit comments

Comments
 (0)