tracing::instrument cleanup
This commit is contained in:
parent
ee3c835018
commit
1fc9ef1edd
40 changed files with 117 additions and 247 deletions
|
@ -391,7 +391,7 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
|
|||
/// Preconditions:
|
||||
///
|
||||
/// - `for_vid` is a "root vid"
|
||||
#[instrument(skip(self), level = "trace")]
|
||||
#[instrument(skip(self), level = "trace", ret)]
|
||||
fn generalize(
|
||||
&self,
|
||||
ty: Ty<'tcx>,
|
||||
|
@ -435,15 +435,8 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
|
|||
cache: SsoHashMap::new(),
|
||||
};
|
||||
|
||||
let ty = match generalize.relate(ty, ty) {
|
||||
Ok(ty) => ty,
|
||||
Err(e) => {
|
||||
debug!(?e, "failure");
|
||||
return Err(e);
|
||||
}
|
||||
};
|
||||
let ty = generalize.relate(ty, ty)?;
|
||||
let needs_wf = generalize.needs_wf;
|
||||
trace!(?ty, ?needs_wf, "success");
|
||||
Ok(Generalization { ty, needs_wf })
|
||||
}
|
||||
|
||||
|
@ -499,6 +492,7 @@ struct Generalizer<'cx, 'tcx> {
|
|||
/// Result from a generalization operation. This includes
|
||||
/// not only the generalized type, but also a bool flag
|
||||
/// indicating whether further WF checks are needed.
|
||||
#[derive(Debug)]
|
||||
struct Generalization<'tcx> {
|
||||
ty: Ty<'tcx>,
|
||||
|
||||
|
@ -856,10 +850,9 @@ impl<'tcx> TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
|
|||
Ok(a.rebind(self.relate(a.skip_binder(), b.skip_binder())?))
|
||||
}
|
||||
|
||||
#[instrument(level = "debug", skip(self))]
|
||||
#[instrument(level = "debug", skip(self), ret)]
|
||||
fn tys(&mut self, t: Ty<'tcx>, _t: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
|
||||
debug_assert_eq!(t, _t);
|
||||
debug!("ConstInferUnifier: t={:?}", t);
|
||||
|
||||
match t.kind() {
|
||||
&ty::Infer(ty::TyVar(vid)) => {
|
||||
|
@ -883,12 +876,7 @@ impl<'tcx> TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
|
|||
.borrow_mut()
|
||||
.type_variables()
|
||||
.new_var(self.for_universe, origin);
|
||||
let u = self.tcx().mk_ty_var(new_var_id);
|
||||
debug!(
|
||||
"ConstInferUnifier: replacing original vid={:?} with new={:?}",
|
||||
vid, u
|
||||
);
|
||||
Ok(u)
|
||||
Ok(self.tcx().mk_ty_var(new_var_id))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -939,7 +927,6 @@ impl<'tcx> TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
|
|||
_c: ty::Const<'tcx>,
|
||||
) -> RelateResult<'tcx, ty::Const<'tcx>> {
|
||||
debug_assert_eq!(c, _c);
|
||||
debug!("ConstInferUnifier: c={:?}", c);
|
||||
|
||||
match c.kind() {
|
||||
ty::ConstKind::Infer(InferConst::Var(vid)) => {
|
||||
|
|
|
@ -69,7 +69,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
/// For more details visit the relevant sections of the [rustc dev guide].
|
||||
///
|
||||
/// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/traits/hrtb.html
|
||||
#[instrument(level = "debug", skip(self))]
|
||||
#[instrument(level = "debug", skip(self), ret)]
|
||||
pub fn replace_bound_vars_with_placeholders<T>(&self, binder: ty::Binder<'tcx, T>) -> T
|
||||
where
|
||||
T: TypeFoldable<'tcx> + Copy,
|
||||
|
@ -104,9 +104,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
},
|
||||
};
|
||||
|
||||
let result = self.tcx.replace_bound_vars_uncached(binder, delegate);
|
||||
debug!(?next_universe, ?result);
|
||||
result
|
||||
debug!(?next_universe);
|
||||
self.tcx.replace_bound_vars_uncached(binder, delegate)
|
||||
}
|
||||
|
||||
/// See [RegionConstraintCollector::leak_check][1].
|
||||
|
|
|
@ -333,9 +333,9 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
|||
///
|
||||
/// Neither `a` nor `b` may be an inference variable (hence the
|
||||
/// term "concrete regions").
|
||||
#[instrument(level = "trace", skip(self))]
|
||||
#[instrument(level = "trace", skip(self), ret)]
|
||||
fn lub_concrete_regions(&self, a: Region<'tcx>, b: Region<'tcx>) -> Region<'tcx> {
|
||||
let r = match (*a, *b) {
|
||||
match (*a, *b) {
|
||||
(ReLateBound(..), _) | (_, ReLateBound(..)) | (ReErased, _) | (_, ReErased) => {
|
||||
bug!("cannot relate region: LUB({:?}, {:?})", a, b);
|
||||
}
|
||||
|
@ -399,11 +399,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
|||
self.tcx().lifetimes.re_static
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
debug!("lub_concrete_regions({:?}, {:?}) = {:?}", a, b, r);
|
||||
|
||||
r
|
||||
}
|
||||
}
|
||||
|
||||
/// After expansion is complete, go and check upper bounds (i.e.,
|
||||
|
|
|
@ -542,7 +542,7 @@ where
|
|||
true
|
||||
}
|
||||
|
||||
#[instrument(skip(self, info), level = "trace")]
|
||||
#[instrument(skip(self, info), level = "trace", ret)]
|
||||
fn relate_with_variance<T: Relate<'tcx>>(
|
||||
&mut self,
|
||||
variance: ty::Variance,
|
||||
|
@ -560,8 +560,6 @@ where
|
|||
|
||||
self.ambient_variance = old_ambient_variance;
|
||||
|
||||
debug!(?r);
|
||||
|
||||
Ok(r)
|
||||
}
|
||||
|
||||
|
|
|
@ -390,7 +390,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
});
|
||||
}
|
||||
|
||||
#[instrument(skip(self), level = "trace")]
|
||||
#[instrument(skip(self), level = "trace", ret)]
|
||||
pub fn opaque_type_origin(&self, def_id: LocalDefId, span: Span) -> Option<OpaqueTyOrigin> {
|
||||
let opaque_hir_id = self.tcx.hir().local_def_id_to_hir_id(def_id);
|
||||
let parent_def_id = match self.defining_use_anchor {
|
||||
|
@ -421,16 +421,14 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
in_definition_scope.then_some(*origin)
|
||||
}
|
||||
|
||||
#[instrument(skip(self), level = "trace")]
|
||||
#[instrument(skip(self), level = "trace", ret)]
|
||||
fn opaque_ty_origin_unchecked(&self, def_id: LocalDefId, span: Span) -> OpaqueTyOrigin {
|
||||
let origin = match self.tcx.hir().expect_item(def_id).kind {
|
||||
match self.tcx.hir().expect_item(def_id).kind {
|
||||
hir::ItemKind::OpaqueTy(hir::OpaqueTy { origin, .. }) => origin,
|
||||
ref itemkind => {
|
||||
span_bug!(span, "weird opaque type: {:?}, {:#?}", def_id, itemkind)
|
||||
}
|
||||
};
|
||||
trace!(?origin);
|
||||
origin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ impl<'tcx> OpaqueTypeStorage<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(level = "debug")]
|
||||
#[instrument(level = "debug", ret)]
|
||||
pub fn take_opaque_types(&mut self) -> OpaqueTypeMap<'tcx> {
|
||||
std::mem::take(&mut self.opaque_types)
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ pub mod verify;
|
|||
use rustc_middle::traits::query::OutlivesBound;
|
||||
use rustc_middle::ty;
|
||||
|
||||
#[instrument(level = "debug", skip(param_env))]
|
||||
#[instrument(level = "debug", skip(param_env), ret)]
|
||||
pub fn explicit_outlives_bounds<'tcx>(
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
) -> impl Iterator<Item = OutlivesBound<'tcx>> + 'tcx {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue