From b6b19f3b6cf9a869ac9c6734b75205ca099af0f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Mon, 6 Sep 2021 00:00:00 +0000 Subject: [PATCH] Use explicit log level in tracing instrument macro Specify a log level in tracing instrument macro explicitly. Additionally reduce the used log level from a default info level to a debug level (all of those appear to be developer oriented logs, so there should be no need to include them in release builds). --- .../src/region_infer/opaque_types.rs | 2 +- .../rustc_monomorphize/src/polymorphize.rs | 20 +++++++++---------- .../src/dep_graph/serialized.rs | 4 ++-- .../rustc_trait_selection/src/opaque_types.rs | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs index 39b83e5043101..d790e31105c8a 100644 --- a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs +++ b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs @@ -46,7 +46,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// Calling `universal_upper_bound` for such a region gives `fr_fn_body`, /// which has no `external_name` in which case we use `'empty` as the /// region to pass to `infer_opaque_definition_from_instantiation`. - #[instrument(skip(self, infcx))] + #[instrument(level = "debug", skip(self, infcx))] pub(crate) fn infer_opaque_types( &self, infcx: &InferCtxt<'_, 'tcx>, diff --git a/compiler/rustc_monomorphize/src/polymorphize.rs b/compiler/rustc_monomorphize/src/polymorphize.rs index 3c55a4b0a8fb1..0f768b7819b5b 100644 --- a/compiler/rustc_monomorphize/src/polymorphize.rs +++ b/compiler/rustc_monomorphize/src/polymorphize.rs @@ -30,7 +30,7 @@ pub fn provide(providers: &mut Providers) { /// Determine which generic parameters are used by the function/method/closure represented by /// `def_id`. Returns a bitset where bits representing unused parameters are set (`is_empty` /// indicates all parameters are used). -#[instrument(skip(tcx))] +#[instrument(level = "debug", skip(tcx))] fn unused_generic_params(tcx: TyCtxt<'_>, def_id: DefId) -> FiniteBitSet { if !tcx.sess.opts.debugging_opts.polymorphize { // If polymorphization disabled, then all parameters are used. @@ -100,7 +100,7 @@ fn unused_generic_params(tcx: TyCtxt<'_>, def_id: DefId) -> FiniteBitSet { /// Some parameters are considered used-by-default, such as non-generic parameters and the dummy /// generic parameters from closures, this function marks them as used. `leaf_is_closure` should /// be `true` if the item that `unused_generic_params` was invoked on is a closure. -#[instrument(skip(tcx, def_id, generics, unused_parameters))] +#[instrument(level = "debug", skip(tcx, def_id, generics, unused_parameters))] fn mark_used_by_default_parameters<'tcx>( tcx: TyCtxt<'tcx>, def_id: DefId, @@ -158,7 +158,7 @@ fn mark_used_by_default_parameters<'tcx>( /// Search the predicates on used generic parameters for any unused generic parameters, and mark /// those as used. -#[instrument(skip(tcx, def_id))] +#[instrument(level = "debug", skip(tcx, def_id))] fn mark_used_by_predicates<'tcx>( tcx: TyCtxt<'tcx>, def_id: DefId, @@ -196,7 +196,7 @@ fn mark_used_by_predicates<'tcx>( /// Emit errors for the function annotated by `#[rustc_polymorphize_error]`, labelling each generic /// parameter which was unused. -#[instrument(skip(tcx, generics))] +#[instrument(level = "debug", skip(tcx, generics))] fn emit_unused_generic_params_error<'tcx>( tcx: TyCtxt<'tcx>, def_id: DefId, @@ -241,7 +241,7 @@ struct MarkUsedGenericParams<'a, 'tcx> { impl<'a, 'tcx> MarkUsedGenericParams<'a, 'tcx> { /// Invoke `unused_generic_params` on a body contained within the current item (e.g. /// a closure, generator or constant). - #[instrument(skip(self, def_id, substs))] + #[instrument(level = "debug", skip(self, def_id, substs))] fn visit_child_body(&mut self, def_id: DefId, substs: SubstsRef<'tcx>) { let unused = self.tcx.unused_generic_params(def_id); debug!(?self.unused_parameters, ?unused); @@ -256,7 +256,7 @@ impl<'a, 'tcx> MarkUsedGenericParams<'a, 'tcx> { } impl<'a, 'tcx> Visitor<'tcx> for MarkUsedGenericParams<'a, 'tcx> { - #[instrument(skip(self, local))] + #[instrument(level = "debug", skip(self, local))] fn visit_local_decl(&mut self, local: Local, local_decl: &LocalDecl<'tcx>) { if local == Local::from_usize(1) { let def_kind = self.tcx.def_kind(self.def_id); @@ -286,7 +286,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for MarkUsedGenericParams<'a, 'tcx> { fn tcx_for_anon_const_substs(&self) -> Option> { Some(self.tcx) } - #[instrument(skip(self))] + #[instrument(level = "debug", skip(self))] fn visit_const(&mut self, c: &'tcx Const<'tcx>) -> ControlFlow { if !c.potentially_has_param_types_or_consts() { return ControlFlow::CONTINUE; @@ -319,7 +319,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for MarkUsedGenericParams<'a, 'tcx> { } } - #[instrument(skip(self))] + #[instrument(level = "debug", skip(self))] fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow { if !ty.potentially_has_param_types_or_consts() { return ControlFlow::CONTINUE; @@ -361,7 +361,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for HasUsedGenericParams<'a, 'tcx> { Some(self.tcx) } - #[instrument(skip(self))] + #[instrument(level = "debug", skip(self))] fn visit_const(&mut self, c: &'tcx Const<'tcx>) -> ControlFlow { if !c.potentially_has_param_types_or_consts() { return ControlFlow::CONTINUE; @@ -379,7 +379,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for HasUsedGenericParams<'a, 'tcx> { } } - #[instrument(skip(self))] + #[instrument(level = "debug", skip(self))] fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow { if !ty.potentially_has_param_types_or_consts() { return ControlFlow::CONTINUE; diff --git a/compiler/rustc_query_system/src/dep_graph/serialized.rs b/compiler/rustc_query_system/src/dep_graph/serialized.rs index 73c00fc49ba39..f5f67fcd0a08c 100644 --- a/compiler/rustc_query_system/src/dep_graph/serialized.rs +++ b/compiler/rustc_query_system/src/dep_graph/serialized.rs @@ -99,7 +99,7 @@ impl SerializedDepGraph { impl<'a, K: DepKind + Decodable>> Decodable> for SerializedDepGraph { - #[instrument(skip(d))] + #[instrument(level = "debug", skip(d))] fn decode(d: &mut opaque::Decoder<'a>) -> Result, String> { let start_position = d.position(); @@ -187,7 +187,7 @@ impl EncoderState { } } - #[instrument(skip(self, record_graph))] + #[instrument(level = "debug", skip(self, record_graph))] fn encode_node( &mut self, node: &NodeInfo, diff --git a/compiler/rustc_trait_selection/src/opaque_types.rs b/compiler/rustc_trait_selection/src/opaque_types.rs index b743c809ca243..8abcdb5e89b47 100644 --- a/compiler/rustc_trait_selection/src/opaque_types.rs +++ b/compiler/rustc_trait_selection/src/opaque_types.rs @@ -499,7 +499,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { /// - `substs`, the substs used to instantiate this opaque type /// - `instantiated_ty`, the inferred type C1 -- fully resolved, lifted version of /// `opaque_defn.concrete_ty` - #[instrument(skip(self))] + #[instrument(level = "debug", skip(self))] fn infer_opaque_definition_from_instantiation( &self, opaque_type_key: OpaqueTypeKey<'tcx>, @@ -863,7 +863,7 @@ struct Instantiator<'a, 'tcx> { } impl<'a, 'tcx> Instantiator<'a, 'tcx> { - #[instrument(skip(self))] + #[instrument(level = "debug", skip(self))] fn instantiate_opaque_types_in_map>(&mut self, value: T) -> T { let tcx = self.infcx.tcx; value.fold_with(&mut BottomUpFolder {