Add some more tracing instrumentation
This commit is contained in:
parent
ee86f96ba1
commit
24a8d3bce3
1 changed files with 6 additions and 8 deletions
|
@ -568,6 +568,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
/// - `substs`, the substs used to instantiate this opaque type
|
/// - `substs`, the substs used to instantiate this opaque type
|
||||||
/// - `instantiated_ty`, the inferred type C1 -- fully resolved, lifted version of
|
/// - `instantiated_ty`, the inferred type C1 -- fully resolved, lifted version of
|
||||||
/// `opaque_defn.concrete_ty`
|
/// `opaque_defn.concrete_ty`
|
||||||
|
#[instrument(skip(self))]
|
||||||
fn infer_opaque_definition_from_instantiation(
|
fn infer_opaque_definition_from_instantiation(
|
||||||
&self,
|
&self,
|
||||||
opaque_type_key: OpaqueTypeKey<'tcx>,
|
opaque_type_key: OpaqueTypeKey<'tcx>,
|
||||||
|
@ -576,11 +577,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
) -> Ty<'tcx> {
|
) -> Ty<'tcx> {
|
||||||
let OpaqueTypeKey { def_id, substs } = opaque_type_key;
|
let OpaqueTypeKey { def_id, substs } = opaque_type_key;
|
||||||
|
|
||||||
debug!(
|
|
||||||
"infer_opaque_definition_from_instantiation(def_id={:?}, instantiated_ty={:?})",
|
|
||||||
def_id, instantiated_ty
|
|
||||||
);
|
|
||||||
|
|
||||||
// Use substs to build up a reverse map from regions to their
|
// Use substs to build up a reverse map from regions to their
|
||||||
// identity mappings. This is necessary because of `impl
|
// identity mappings. This is necessary because of `impl
|
||||||
// Trait` lifetimes are computed by replacing existing
|
// Trait` lifetimes are computed by replacing existing
|
||||||
|
@ -588,6 +584,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
// `impl Trait` return type, resulting in the parameters
|
// `impl Trait` return type, resulting in the parameters
|
||||||
// shifting.
|
// shifting.
|
||||||
let id_substs = InternalSubsts::identity_for_item(self.tcx, def_id);
|
let id_substs = InternalSubsts::identity_for_item(self.tcx, def_id);
|
||||||
|
debug!(?id_substs);
|
||||||
let map: FxHashMap<GenericArg<'tcx>, GenericArg<'tcx>> =
|
let map: FxHashMap<GenericArg<'tcx>, GenericArg<'tcx>> =
|
||||||
substs.iter().enumerate().map(|(index, subst)| (subst, id_substs[index])).collect();
|
substs.iter().enumerate().map(|(index, subst)| (subst, id_substs[index])).collect();
|
||||||
|
|
||||||
|
@ -602,7 +599,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
instantiated_ty,
|
instantiated_ty,
|
||||||
span,
|
span,
|
||||||
));
|
));
|
||||||
debug!("infer_opaque_definition_from_instantiation: definition_ty={:?}", definition_ty);
|
debug!(?definition_ty);
|
||||||
|
|
||||||
definition_ty
|
definition_ty
|
||||||
}
|
}
|
||||||
|
@ -857,7 +854,7 @@ impl TypeFolder<'tcx> for ReverseMapper<'tcx> {
|
||||||
self.tcx.mk_generator(def_id, substs, movability)
|
self.tcx.mk_generator(def_id, substs, movability)
|
||||||
}
|
}
|
||||||
|
|
||||||
ty::Param(..) => {
|
ty::Param(param) => {
|
||||||
// Look it up in the substitution list.
|
// Look it up in the substitution list.
|
||||||
match self.map.get(&ty.into()).map(|k| k.unpack()) {
|
match self.map.get(&ty.into()).map(|k| k.unpack()) {
|
||||||
// Found it in the substitution list; replace with the parameter from the
|
// Found it in the substitution list; replace with the parameter from the
|
||||||
|
@ -865,6 +862,7 @@ impl TypeFolder<'tcx> for ReverseMapper<'tcx> {
|
||||||
Some(GenericArgKind::Type(t1)) => t1,
|
Some(GenericArgKind::Type(t1)) => t1,
|
||||||
Some(u) => panic!("type mapped to unexpected kind: {:?}", u),
|
Some(u) => panic!("type mapped to unexpected kind: {:?}", u),
|
||||||
None => {
|
None => {
|
||||||
|
debug!(?param, ?self.map);
|
||||||
self.tcx
|
self.tcx
|
||||||
.sess
|
.sess
|
||||||
.struct_span_err(
|
.struct_span_err(
|
||||||
|
@ -931,8 +929,8 @@ struct Instantiator<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> Instantiator<'a, 'tcx> {
|
impl<'a, 'tcx> Instantiator<'a, 'tcx> {
|
||||||
|
#[instrument(skip(self))]
|
||||||
fn instantiate_opaque_types_in_map<T: TypeFoldable<'tcx>>(&mut self, value: T) -> T {
|
fn instantiate_opaque_types_in_map<T: TypeFoldable<'tcx>>(&mut self, value: T) -> T {
|
||||||
debug!("instantiate_opaque_types_in_map(value={:?})", value);
|
|
||||||
let tcx = self.infcx.tcx;
|
let tcx = self.infcx.tcx;
|
||||||
value.fold_with(&mut BottomUpFolder {
|
value.fold_with(&mut BottomUpFolder {
|
||||||
tcx,
|
tcx,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue