Skip to content

Commit 24a8d3b

Browse files
committed
Add some more tracing instrumentation
1 parent ee86f96 commit 24a8d3b

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Diff for: compiler/rustc_trait_selection/src/opaque_types.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
568568
/// - `substs`, the substs used to instantiate this opaque type
569569
/// - `instantiated_ty`, the inferred type C1 -- fully resolved, lifted version of
570570
/// `opaque_defn.concrete_ty`
571+
#[instrument(skip(self))]
571572
fn infer_opaque_definition_from_instantiation(
572573
&self,
573574
opaque_type_key: OpaqueTypeKey<'tcx>,
@@ -576,18 +577,14 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
576577
) -> Ty<'tcx> {
577578
let OpaqueTypeKey { def_id, substs } = opaque_type_key;
578579

579-
debug!(
580-
"infer_opaque_definition_from_instantiation(def_id={:?}, instantiated_ty={:?})",
581-
def_id, instantiated_ty
582-
);
583-
584580
// Use substs to build up a reverse map from regions to their
585581
// identity mappings. This is necessary because of `impl
586582
// Trait` lifetimes are computed by replacing existing
587583
// lifetimes with 'static and remapping only those used in the
588584
// `impl Trait` return type, resulting in the parameters
589585
// shifting.
590586
let id_substs = InternalSubsts::identity_for_item(self.tcx, def_id);
587+
debug!(?id_substs);
591588
let map: FxHashMap<GenericArg<'tcx>, GenericArg<'tcx>> =
592589
substs.iter().enumerate().map(|(index, subst)| (subst, id_substs[index])).collect();
593590

@@ -602,7 +599,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
602599
instantiated_ty,
603600
span,
604601
));
605-
debug!("infer_opaque_definition_from_instantiation: definition_ty={:?}", definition_ty);
602+
debug!(?definition_ty);
606603

607604
definition_ty
608605
}
@@ -857,14 +854,15 @@ impl TypeFolder<'tcx> for ReverseMapper<'tcx> {
857854
self.tcx.mk_generator(def_id, substs, movability)
858855
}
859856

860-
ty::Param(..) => {
857+
ty::Param(param) => {
861858
// Look it up in the substitution list.
862859
match self.map.get(&ty.into()).map(|k| k.unpack()) {
863860
// Found it in the substitution list; replace with the parameter from the
864861
// opaque type.
865862
Some(GenericArgKind::Type(t1)) => t1,
866863
Some(u) => panic!("type mapped to unexpected kind: {:?}", u),
867864
None => {
865+
debug!(?param, ?self.map);
868866
self.tcx
869867
.sess
870868
.struct_span_err(
@@ -931,8 +929,8 @@ struct Instantiator<'a, 'tcx> {
931929
}
932930

933931
impl<'a, 'tcx> Instantiator<'a, 'tcx> {
932+
#[instrument(skip(self))]
934933
fn instantiate_opaque_types_in_map<T: TypeFoldable<'tcx>>(&mut self, value: T) -> T {
935-
debug!("instantiate_opaque_types_in_map(value={:?})", value);
936934
let tcx = self.infcx.tcx;
937935
value.fold_with(&mut BottomUpFolder {
938936
tcx,

0 commit comments

Comments
 (0)