param_env debugs are instrumental to rustc's success

This commit is contained in:
Ellen 2021-02-14 11:18:40 +00:00
parent a419e112db
commit 7bd71262f8
4 changed files with 6 additions and 9 deletions

View file

@ -10,11 +10,11 @@ use traits::{translate_substs, Reveal};
use tracing::debug;
#[instrument(level = "debug", skip(tcx))]
fn resolve_instance<'tcx>(
tcx: TyCtxt<'tcx>,
key: ty::ParamEnvAnd<'tcx, (DefId, SubstsRef<'tcx>)>,
) -> Result<Option<Instance<'tcx>>, ErrorReported> {
debug!("resolve_instance: key = {:?}", key);
let (param_env, (did, substs)) = key.into_parts();
if let Some(did) = did.as_local() {
if let Some(param_did) = tcx.opt_const_param_of(did) {
@ -39,13 +39,13 @@ fn resolve_instance_of_const_arg<'tcx>(
)
}
#[instrument(level = "debug", skip(tcx))]
fn inner_resolve_instance<'tcx>(
tcx: TyCtxt<'tcx>,
key: ty::ParamEnvAnd<'tcx, (ty::WithOptConstParam<DefId>, SubstsRef<'tcx>)>,
) -> Result<Option<Instance<'tcx>>, ErrorReported> {
let (param_env, (def, substs)) = key.into_parts();
debug!("inner_resolve_instance: key={:?}", key);
let result = if let Some(trait_def_id) = tcx.trait_of_item(def.did) {
debug!(" => associated item, attempting to find impl in param_env {:#?}", param_env);
let item = tcx.associated_item(def.did);
@ -94,10 +94,7 @@ fn inner_resolve_instance<'tcx>(
};
Ok(Some(Instance { def, substs }))
};
debug!(
"inner_resolve_instance: resolve(def.did={:?}, substs={:?}) = {:?}",
def.did, substs, result
);
debug!("inner_resolve_instance: result={:?}", result);
result
}