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

@ -221,6 +221,7 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
/// As `3 + 4` contains `N` in its substs, this must not succeed.
///
/// See `src/test/ui/const-generics/occurs-check/` for more examples where this is relevant.
#[instrument(level = "debug", skip(self))]
fn unify_const_variable(
&self,
param_env: ty::ParamEnv<'tcx>,
@ -228,7 +229,6 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
ct: &'tcx ty::Const<'tcx>,
vid_is_expected: bool,
) -> RelateResult<'tcx, &'tcx ty::Const<'tcx>> {
debug!("unify_const_variable: param_env={:?}", param_env);
let (for_universe, span) = {
let mut inner = self.inner.borrow_mut();
let variable_table = &mut inner.const_unification_table();

View file

@ -31,6 +31,7 @@ impl<'tcx> TyCtxt<'tcx> {
/// constant `bar::<T>()` requires a substitution for `T`, if the substitution for `T` is still
/// too generic for the constant to be evaluated then `Err(ErrorHandled::TooGeneric)` is
/// returned.
#[instrument(level = "debug", skip(self))]
pub fn const_eval_resolve(
self,
param_env: ty::ParamEnv<'tcx>,
@ -39,7 +40,6 @@ impl<'tcx> TyCtxt<'tcx> {
promoted: Option<mir::Promoted>,
span: Option<Span>,
) -> EvalToConstValueResult<'tcx> {
debug!("const_eval_resolve: param_env={:?}", param_env);
match ty::Instance::resolve_opt_const_arg(self, param_env, def, substs) {
Ok(Some(instance)) => {
let cid = GlobalId { instance, promoted };

View file

@ -347,13 +347,13 @@ impl<'tcx> Instance<'tcx> {
}
// This should be kept up to date with `resolve`.
#[instrument(level = "debug", skip(tcx))]
pub fn resolve_opt_const_arg(
tcx: TyCtxt<'tcx>,
param_env: ty::ParamEnv<'tcx>,
def: ty::WithOptConstParam<DefId>,
substs: SubstsRef<'tcx>,
) -> Result<Option<Instance<'tcx>>, ErrorReported> {
debug!("resolve_opt_const_arg: param_env={:?},substs={:?}", param_env, substs);
// All regions in the result of this query are erased, so it's
// fine to erase all of the input regions.

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
}