diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-06-28 15:18:07 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-09-01 14:54:27 +0000 |
| commit | 1fc9ef1edd30ae5a924c3673d76f275f7d12c3fb (patch) | |
| tree | bfcd5b96fdb596e08a0b0b187163a65287dfe777 /compiler/rustc_infer | |
| parent | ee3c8350189de045ec71997874eaa6cebf99fbf3 (diff) | |
| download | rust-1fc9ef1edd30ae5a924c3673d76f275f7d12c3fb.tar.gz rust-1fc9ef1edd30ae5a924c3673d76f275f7d12c3fb.zip | |
tracing::instrument cleanup
Diffstat (limited to 'compiler/rustc_infer')
| -rw-r--r-- | compiler/rustc_infer/src/infer/combine.rs | 23 | ||||
| -rw-r--r-- | compiler/rustc_infer/src/infer/higher_ranked/mod.rs | 7 | ||||
| -rw-r--r-- | compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_infer/src/infer/nll_relate/mod.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_infer/src/infer/opaque_types.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_infer/src/infer/opaque_types/table.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_infer/src/infer/outlives/mod.rs | 2 |
7 files changed, 18 insertions, 40 deletions
diff --git a/compiler/rustc_infer/src/infer/combine.rs b/compiler/rustc_infer/src/infer/combine.rs index 99d8f57505c..d4350aa5734 100644 --- a/compiler/rustc_infer/src/infer/combine.rs +++ b/compiler/rustc_infer/src/infer/combine.rs @@ -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)) => { diff --git a/compiler/rustc_infer/src/infer/higher_ranked/mod.rs b/compiler/rustc_infer/src/infer/higher_ranked/mod.rs index d0d9efe152c..67426fcf0fe 100644 --- a/compiler/rustc_infer/src/infer/higher_ranked/mod.rs +++ b/compiler/rustc_infer/src/infer/higher_ranked/mod.rs @@ -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]. diff --git a/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs b/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs index 3783cfb4cc5..13b7e8eb964 100644 --- a/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs +++ b/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs @@ -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., diff --git a/compiler/rustc_infer/src/infer/nll_relate/mod.rs b/compiler/rustc_infer/src/infer/nll_relate/mod.rs index e7e93116a66..bb6f6ae60e2 100644 --- a/compiler/rustc_infer/src/infer/nll_relate/mod.rs +++ b/compiler/rustc_infer/src/infer/nll_relate/mod.rs @@ -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) } diff --git a/compiler/rustc_infer/src/infer/opaque_types.rs b/compiler/rustc_infer/src/infer/opaque_types.rs index 233a5004a39..d45adf43abf 100644 --- a/compiler/rustc_infer/src/infer/opaque_types.rs +++ b/compiler/rustc_infer/src/infer/opaque_types.rs @@ -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 + } } } diff --git a/compiler/rustc_infer/src/infer/opaque_types/table.rs b/compiler/rustc_infer/src/infer/opaque_types/table.rs index fb12da0cc13..4d124554afb 100644 --- a/compiler/rustc_infer/src/infer/opaque_types/table.rs +++ b/compiler/rustc_infer/src/infer/opaque_types/table.rs @@ -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) } diff --git a/compiler/rustc_infer/src/infer/outlives/mod.rs b/compiler/rustc_infer/src/infer/outlives/mod.rs index 2a085288fb7..2d19d1823fd 100644 --- a/compiler/rustc_infer/src/infer/outlives/mod.rs +++ b/compiler/rustc_infer/src/infer/outlives/mod.rs @@ -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 { |
