Move mir_def_id inside eq_opaque_type_and_type
This commit is contained in:
parent
a002f4513b
commit
75585b408f
@ -122,7 +122,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||||||
if let Err(terr) = self.eq_opaque_type_and_type(
|
if let Err(terr) = self.eq_opaque_type_and_type(
|
||||||
mir_output_ty,
|
mir_output_ty,
|
||||||
normalized_output_ty,
|
normalized_output_ty,
|
||||||
mir_def_id,
|
|
||||||
Locations::All(output_span),
|
Locations::All(output_span),
|
||||||
ConstraintCategory::BoringNoLocation,
|
ConstraintCategory::BoringNoLocation,
|
||||||
) {
|
) {
|
||||||
@ -145,7 +144,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||||||
if let Err(err) = self.eq_opaque_type_and_type(
|
if let Err(err) = self.eq_opaque_type_and_type(
|
||||||
mir_output_ty,
|
mir_output_ty,
|
||||||
user_provided_output_ty,
|
user_provided_output_ty,
|
||||||
mir_def_id,
|
|
||||||
Locations::All(output_span),
|
Locations::All(output_span),
|
||||||
ConstraintCategory::BoringNoLocation,
|
ConstraintCategory::BoringNoLocation,
|
||||||
) {
|
) {
|
||||||
|
@ -1182,7 +1182,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Equates a type `anon_ty` that may contain opaque types whose
|
/// 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
|
/// The type `revealed_ty` contains the same type as `anon_ty`, but with the
|
||||||
/// hidden types for impl traits revealed.
|
/// hidden types for impl traits revealed.
|
||||||
@ -1210,12 +1210,10 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||||||
/// generics of `foo`). Note that `anon_ty` is not just the opaque type,
|
/// 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).
|
/// but the entire return type (which may contain opaque types within it).
|
||||||
/// * `revealed_ty` would be `Box<(T, u32)>`
|
/// * `revealed_ty` would be `Box<(T, u32)>`
|
||||||
/// * `anon_owner_def_id` would be the def-id of `foo`
|
|
||||||
fn eq_opaque_type_and_type(
|
fn eq_opaque_type_and_type(
|
||||||
&mut self,
|
&mut self,
|
||||||
revealed_ty: Ty<'tcx>,
|
revealed_ty: Ty<'tcx>,
|
||||||
anon_ty: Ty<'tcx>,
|
anon_ty: Ty<'tcx>,
|
||||||
anon_owner_def_id: LocalDefId,
|
|
||||||
locations: Locations,
|
locations: Locations,
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory,
|
||||||
) -> Fallible<()> {
|
) -> Fallible<()> {
|
||||||
@ -1245,12 +1243,13 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||||||
let tcx = infcx.tcx;
|
let tcx = infcx.tcx;
|
||||||
let param_env = self.param_env;
|
let param_env = self.param_env;
|
||||||
let body = self.body;
|
let body = self.body;
|
||||||
|
let mir_def_id = body.source.def_id().expect_local();
|
||||||
|
|
||||||
// the "concrete opaque types" maps
|
// 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();
|
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(
|
let opaque_type_map = self.fully_perform_op(
|
||||||
locations,
|
locations,
|
||||||
category,
|
category,
|
||||||
@ -1268,7 +1267,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||||||
// any generic parameters.)
|
// any generic parameters.)
|
||||||
let (output_ty, opaque_type_map) =
|
let (output_ty, opaque_type_map) =
|
||||||
obligations.add(infcx.instantiate_opaque_types(
|
obligations.add(infcx.instantiate_opaque_types(
|
||||||
anon_owner_def_id,
|
mir_def_id,
|
||||||
dummy_body_id,
|
dummy_body_id,
|
||||||
param_env,
|
param_env,
|
||||||
anon_ty,
|
anon_ty,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user