Skip to content

Commit d3b22c7

Browse files
committed
Directly use the instrument macro instead of its full path
1 parent 4f9898a commit d3b22c7

File tree

25 files changed

+86
-89
lines changed

25 files changed

+86
-89
lines changed

compiler/rustc_ast_lowering/src/index.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub(super) struct NodeCollector<'a, 'hir> {
3131
definitions: &'a definitions::Definitions,
3232
}
3333

34-
#[tracing::instrument(level = "debug", skip(sess, definitions, bodies))]
34+
#[instrument(level = "debug", skip(sess, definitions, bodies))]
3535
pub(super) fn index_hir<'hir>(
3636
sess: &Session,
3737
definitions: &definitions::Definitions,
@@ -67,7 +67,7 @@ pub(super) fn index_hir<'hir>(
6767
}
6868

6969
impl<'a, 'hir> NodeCollector<'a, 'hir> {
70-
#[tracing::instrument(level = "debug", skip(self))]
70+
#[instrument(level = "debug", skip(self))]
7171
fn insert(&mut self, span: Span, hir_id: HirId, node: Node<'hir>) {
7272
debug_assert_eq!(self.owner, hir_id.owner);
7373
debug_assert_ne!(hir_id.local_id.as_u32(), 0);
@@ -142,7 +142,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
142142
});
143143
}
144144

145-
#[tracing::instrument(level = "debug", skip(self))]
145+
#[instrument(level = "debug", skip(self))]
146146
fn visit_item(&mut self, i: &'hir Item<'hir>) {
147147
debug_assert_eq!(i.def_id, self.owner);
148148
self.with_parent(i.hir_id(), |this| {
@@ -156,7 +156,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
156156
});
157157
}
158158

159-
#[tracing::instrument(level = "debug", skip(self))]
159+
#[instrument(level = "debug", skip(self))]
160160
fn visit_foreign_item(&mut self, fi: &'hir ForeignItem<'hir>) {
161161
debug_assert_eq!(fi.def_id, self.owner);
162162
self.with_parent(fi.hir_id(), |this| {
@@ -175,15 +175,15 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
175175
})
176176
}
177177

178-
#[tracing::instrument(level = "debug", skip(self))]
178+
#[instrument(level = "debug", skip(self))]
179179
fn visit_trait_item(&mut self, ti: &'hir TraitItem<'hir>) {
180180
debug_assert_eq!(ti.def_id, self.owner);
181181
self.with_parent(ti.hir_id(), |this| {
182182
intravisit::walk_trait_item(this, ti);
183183
});
184184
}
185185

186-
#[tracing::instrument(level = "debug", skip(self))]
186+
#[instrument(level = "debug", skip(self))]
187187
fn visit_impl_item(&mut self, ii: &'hir ImplItem<'hir>) {
188188
debug_assert_eq!(ii.def_id, self.owner);
189189
self.with_parent(ii.hir_id(), |this| {

compiler/rustc_ast_lowering/src/lib.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl ResolverAstLoweringExt for ResolverAstLowering {
220220
/// Panics if no map has been pushed.
221221
/// Remapping is used when creating lowering `-> impl Trait` return
222222
/// types to create the resulting opaque type.
223-
#[tracing::instrument(level = "debug", skip(self))]
223+
#[instrument(level = "debug", skip(self))]
224224
fn record_def_id_remap(&mut self, from: LocalDefId, to: LocalDefId) {
225225
self.generics_def_id_map.last_mut().expect("no map pushed").insert(from, to);
226226
}
@@ -771,7 +771,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
771771
}
772772

773773
/// Converts a lifetime into a new generic parameter.
774-
#[tracing::instrument(level = "debug", skip(self))]
774+
#[instrument(level = "debug", skip(self))]
775775
fn lifetime_res_to_generic_param(
776776
&mut self,
777777
ident: Ident,
@@ -815,7 +815,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
815815
/// name resolver owing to lifetime elision; this also populates the resolver's node-id->def-id
816816
/// map, so that later calls to `opt_node_id_to_def_id` that refer to these extra lifetime
817817
/// parameters will be successful.
818-
#[tracing::instrument(level = "debug", skip(self))]
818+
#[instrument(level = "debug", skip(self))]
819819
#[inline]
820820
fn lower_lifetime_binder(
821821
&mut self,
@@ -1385,7 +1385,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
13851385
/// added explicitly in the HIR). But this includes all the lifetimes, and we only want to
13861386
/// capture the lifetimes that are referenced in the bounds. Therefore, we add *extra* lifetime parameters
13871387
/// for the lifetimes that get captured (`'x`, in our example above) and reference those.
1388-
#[tracing::instrument(level = "debug", skip(self))]
1388+
#[instrument(level = "debug", skip(self))]
13891389
fn lower_opaque_impl_trait(
13901390
&mut self,
13911391
span: Span,
@@ -1621,7 +1621,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
16211621
// `make_ret_async`: if `Some`, converts `-> T` into `-> impl Future<Output = T>` in the
16221622
// return type. This is used for `async fn` declarations. The `NodeId` is the ID of the
16231623
// return type `impl Trait` item.
1624-
#[tracing::instrument(level = "debug", skip(self))]
1624+
#[instrument(level = "debug", skip(self))]
16251625
fn lower_fn_decl(
16261626
&mut self,
16271627
decl: &FnDecl,
@@ -1730,7 +1730,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
17301730
// `output`: unlowered output type (`T` in `-> T`)
17311731
// `fn_def_id`: `DefId` of the parent function (used to create child impl trait definition)
17321732
// `opaque_ty_node_id`: `NodeId` of the opaque `impl Trait` type that should be created
1733-
#[tracing::instrument(level = "debug", skip(self))]
1733+
#[instrument(level = "debug", skip(self))]
17341734
fn lower_async_fn_ret_ty(
17351735
&mut self,
17361736
output: &FnRetTy,
@@ -2013,7 +2013,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20132013
self.new_named_lifetime(l.id, l.id, span, ident)
20142014
}
20152015

2016-
#[tracing::instrument(level = "debug", skip(self))]
2016+
#[instrument(level = "debug", skip(self))]
20172017
fn new_named_lifetime_with_res(
20182018
&mut self,
20192019
id: NodeId,
@@ -2044,7 +2044,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20442044
hir::Lifetime { hir_id: self.lower_node_id(id), span: self.lower_span(span), name }
20452045
}
20462046

2047-
#[tracing::instrument(level = "debug", skip(self))]
2047+
#[instrument(level = "debug", skip(self))]
20482048
fn new_named_lifetime(
20492049
&mut self,
20502050
id: NodeId,
@@ -2132,7 +2132,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
21322132
hir::TraitRef { path, hir_ref_id: self.lower_node_id(p.ref_id) }
21332133
}
21342134

2135-
#[tracing::instrument(level = "debug", skip(self))]
2135+
#[instrument(level = "debug", skip(self))]
21362136
fn lower_poly_trait_ref(
21372137
&mut self,
21382138
p: &PolyTraitRef,

compiler/rustc_borrowck/src/diagnostics/region_name.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
265265
/// *user* has a name for. In that case, we'll be able to map
266266
/// `fr` to a `Region<'tcx>`, and that region will be one of
267267
/// named variants.
268-
#[tracing::instrument(level = "trace", skip(self))]
268+
#[instrument(level = "trace", skip(self))]
269269
fn give_name_from_error_region(&self, fr: RegionVid) -> Option<RegionName> {
270270
let error_region = self.to_error_region(fr)?;
271271

@@ -373,7 +373,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
373373
/// | fn foo(x: &u32) { .. }
374374
/// ------- fully elaborated type of `x` is `&'1 u32`
375375
/// ```
376-
#[tracing::instrument(level = "trace", skip(self))]
376+
#[instrument(level = "trace", skip(self))]
377377
fn give_name_if_anonymous_region_appears_in_arguments(
378378
&self,
379379
fr: RegionVid,
@@ -662,7 +662,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
662662
/// | let x = Some(&22);
663663
/// - fully elaborated type of `x` is `Option<&'1 u32>`
664664
/// ```
665-
#[tracing::instrument(level = "trace", skip(self))]
665+
#[instrument(level = "trace", skip(self))]
666666
fn give_name_if_anonymous_region_appears_in_upvars(&self, fr: RegionVid) -> Option<RegionName> {
667667
let upvar_index = self.regioncx.get_upvar_index_for_region(self.infcx.tcx, fr)?;
668668
let (upvar_name, upvar_span) = self.regioncx.get_upvar_name_and_span_for_region(
@@ -682,7 +682,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
682682
/// must be a closure since, in a free fn, such an argument would
683683
/// have to either also appear in an argument (if using elision)
684684
/// or be early bound (named, not in argument).
685-
#[tracing::instrument(level = "trace", skip(self))]
685+
#[instrument(level = "trace", skip(self))]
686686
fn give_name_if_anonymous_region_appears_in_output(&self, fr: RegionVid) -> Option<RegionName> {
687687
let tcx = self.infcx.tcx;
688688
let hir = tcx.hir();
@@ -814,7 +814,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
814814
}
815815
}
816816

817-
#[tracing::instrument(level = "trace", skip(self))]
817+
#[instrument(level = "trace", skip(self))]
818818
fn give_name_if_anonymous_region_appears_in_yield_ty(
819819
&self,
820820
fr: RegionVid,

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ use rustc_span::{self, FileNameDisplayPreference, SourceFile};
4242
use rustc_symbol_mangling::typeid_for_trait_ref;
4343
use rustc_target::abi::{Align, Size};
4444
use smallvec::smallvec;
45-
use tracing::debug;
4645

4746
use libc::{c_char, c_longlong, c_uint};
4847
use std::borrow::Cow;
@@ -51,7 +50,6 @@ use std::hash::{Hash, Hasher};
5150
use std::iter;
5251
use std::path::{Path, PathBuf};
5352
use std::ptr;
54-
use tracing::instrument;
5553

5654
impl PartialEq for llvm::Metadata {
5755
fn eq(&self, other: &Self) -> bool {

compiler/rustc_codegen_llvm/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
#[macro_use]
1818
extern crate rustc_macros;
19+
#[macro_use]
20+
extern crate tracing;
1921

2022
use back::write::{create_informational_target_machine, create_target_machine};
2123

compiler/rustc_const_eval/src/interpret/intern.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ pub enum InternKind {
334334
/// tracks where in the value we are and thus can show much better error messages.
335335
/// Any errors here would anyway be turned into `const_err` lints, whereas validation failures
336336
/// are hard errors.
337-
#[tracing::instrument(level = "debug", skip(ecx))]
337+
#[instrument(level = "debug", skip(ecx))]
338338
pub fn intern_const_alloc_recursive<
339339
'mir,
340340
'tcx: 'mir,

compiler/rustc_infer/src/infer/combine.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ impl<'tcx> TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
856856
Ok(a.rebind(self.relate(a.skip_binder(), b.skip_binder())?))
857857
}
858858

859-
#[tracing::instrument(level = "debug", skip(self))]
859+
#[instrument(level = "debug", skip(self))]
860860
fn tys(&mut self, t: Ty<'tcx>, _t: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
861861
debug_assert_eq!(t, _t);
862862
debug!("ConstInferUnifier: t={:?}", t);
@@ -932,7 +932,7 @@ impl<'tcx> TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
932932
}
933933
}
934934

935-
#[tracing::instrument(level = "debug", skip(self))]
935+
#[instrument(level = "debug", skip(self))]
936936
fn consts(
937937
&mut self,
938938
c: ty::Const<'tcx>,

compiler/rustc_infer/src/infer/error_reporting/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
14341434
/// the message in `secondary_span` as the primary label, and apply the message that would
14351435
/// otherwise be used for the primary label on the `secondary_span` `Span`. This applies on
14361436
/// E0271, like `src/test/ui/issues/issue-39970.stderr`.
1437-
#[tracing::instrument(
1437+
#[instrument(
14381438
level = "debug",
14391439
skip(self, diag, secondary_span, swap_secondary_and_primary, prefer_label)
14401440
)]

compiler/rustc_infer/src/infer/outlives/obligations.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ where
313313
self.delegate.push_verify(origin, generic, region, verify_bound);
314314
}
315315

316-
#[tracing::instrument(level = "debug", skip(self))]
316+
#[instrument(level = "debug", skip(self))]
317317
fn projection_must_outlive(
318318
&mut self,
319319
origin: infer::SubregionOrigin<'tcx>,

compiler/rustc_infer/src/infer/outlives/test_type_match.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use crate::infer::region_constraints::VerifyIfEq;
3434
/// like are used. This is a particular challenge since this function is invoked
3535
/// very late in inference and hence cannot make use of the normal inference
3636
/// machinery.
37-
#[tracing::instrument(level = "debug", skip(tcx, param_env))]
37+
#[instrument(level = "debug", skip(tcx, param_env))]
3838
pub fn extract_verify_if_eq<'tcx>(
3939
tcx: TyCtxt<'tcx>,
4040
param_env: ty::ParamEnv<'tcx>,
@@ -71,7 +71,7 @@ pub fn extract_verify_if_eq<'tcx>(
7171
}
7272

7373
/// True if a (potentially higher-ranked) outlives
74-
#[tracing::instrument(level = "debug", skip(tcx, param_env))]
74+
#[instrument(level = "debug", skip(tcx, param_env))]
7575
pub(super) fn can_match_erased_ty<'tcx>(
7676
tcx: TyCtxt<'tcx>,
7777
param_env: ty::ParamEnv<'tcx>,
@@ -110,7 +110,7 @@ impl<'tcx> Match<'tcx> {
110110

111111
/// Binds the pattern variable `br` to `value`; returns an `Err` if the pattern
112112
/// is already bound to a different value.
113-
#[tracing::instrument(level = "debug", skip(self))]
113+
#[instrument(level = "debug", skip(self))]
114114
fn bind(
115115
&mut self,
116116
br: ty::BoundRegion,

compiler/rustc_mir_build/src/build/matches/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
155155
///
156156
/// * From each pre-binding block to the next pre-binding block.
157157
/// * From each otherwise block to the next pre-binding block.
158-
#[tracing::instrument(level = "debug", skip(self, arms))]
158+
#[instrument(level = "debug", skip(self, arms))]
159159
pub(crate) fn match_expr(
160160
&mut self,
161161
destination: Place<'tcx>,

compiler/rustc_mir_build/src/thir/cx/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl<'tcx> Cx<'tcx> {
7777
}
7878
}
7979

80-
#[tracing::instrument(level = "debug", skip(self))]
80+
#[instrument(level = "debug", skip(self))]
8181
pub(crate) fn pattern_from_hir(&mut self, p: &hir::Pat<'_>) -> Pat<'tcx> {
8282
let p = match self.tcx.hir().get(p.hir_id) {
8383
Node::Pat(p) => p,

compiler/rustc_passes/src/liveness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1573,7 +1573,7 @@ impl<'tcx> Liveness<'_, 'tcx> {
15731573
}
15741574
}
15751575

1576-
#[tracing::instrument(skip(self), level = "INFO")]
1576+
#[instrument(skip(self), level = "INFO")]
15771577
fn report_unused(
15781578
&self,
15791579
hir_ids_and_spans: Vec<(HirId, Span, Span)>,

compiler/rustc_resolve/src/ident.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ impl<'a> Resolver<'a> {
273273
///
274274
/// Invariant: This must only be called during main resolution, not during
275275
/// import resolution.
276-
#[tracing::instrument(level = "debug", skip(self, ribs))]
276+
#[instrument(level = "debug", skip(self, ribs))]
277277
pub(crate) fn resolve_ident_in_lexical_scope(
278278
&mut self,
279279
mut ident: Ident,
@@ -367,7 +367,7 @@ impl<'a> Resolver<'a> {
367367
/// expansion and import resolution (perhaps they can be merged in the future).
368368
/// The function is used for resolving initial segments of macro paths (e.g., `foo` in
369369
/// `foo::bar!(); or `foo!();`) and also for import paths on 2018 edition.
370-
#[tracing::instrument(level = "debug", skip(self, scope_set))]
370+
#[instrument(level = "debug", skip(self, scope_set))]
371371
pub(crate) fn early_resolve_ident_in_lexical_scope(
372372
&mut self,
373373
orig_ident: Ident,
@@ -708,7 +708,7 @@ impl<'a> Resolver<'a> {
708708
Err(Determinacy::determined(determinacy == Determinacy::Determined || force))
709709
}
710710

711-
#[tracing::instrument(level = "debug", skip(self))]
711+
#[instrument(level = "debug", skip(self))]
712712
pub(crate) fn maybe_resolve_ident_in_module(
713713
&mut self,
714714
module: ModuleOrUniformRoot<'a>,
@@ -720,7 +720,7 @@ impl<'a> Resolver<'a> {
720720
.map_err(|(determinacy, _)| determinacy)
721721
}
722722

723-
#[tracing::instrument(level = "debug", skip(self))]
723+
#[instrument(level = "debug", skip(self))]
724724
pub(crate) fn resolve_ident_in_module(
725725
&mut self,
726726
module: ModuleOrUniformRoot<'a>,
@@ -734,7 +734,7 @@ impl<'a> Resolver<'a> {
734734
.map_err(|(determinacy, _)| determinacy)
735735
}
736736

737-
#[tracing::instrument(level = "debug", skip(self))]
737+
#[instrument(level = "debug", skip(self))]
738738
fn resolve_ident_in_module_ext(
739739
&mut self,
740740
module: ModuleOrUniformRoot<'a>,
@@ -772,7 +772,7 @@ impl<'a> Resolver<'a> {
772772
)
773773
}
774774

775-
#[tracing::instrument(level = "debug", skip(self))]
775+
#[instrument(level = "debug", skip(self))]
776776
fn resolve_ident_in_module_unadjusted(
777777
&mut self,
778778
module: ModuleOrUniformRoot<'a>,
@@ -796,7 +796,7 @@ impl<'a> Resolver<'a> {
796796

797797
/// Attempts to resolve `ident` in namespaces `ns` of `module`.
798798
/// Invariant: if `finalize` is `Some`, expansion and import resolution must be complete.
799-
#[tracing::instrument(level = "debug", skip(self))]
799+
#[instrument(level = "debug", skip(self))]
800800
fn resolve_ident_in_module_unadjusted_ext(
801801
&mut self,
802802
module: ModuleOrUniformRoot<'a>,
@@ -1059,7 +1059,7 @@ impl<'a> Resolver<'a> {
10591059
}
10601060

10611061
/// Validate a local resolution (from ribs).
1062-
#[tracing::instrument(level = "debug", skip(self, all_ribs))]
1062+
#[instrument(level = "debug", skip(self, all_ribs))]
10631063
fn validate_res_from_ribs(
10641064
&mut self,
10651065
rib_index: usize,
@@ -1294,7 +1294,7 @@ impl<'a> Resolver<'a> {
12941294
res
12951295
}
12961296

1297-
#[tracing::instrument(level = "debug", skip(self))]
1297+
#[instrument(level = "debug", skip(self))]
12981298
pub(crate) fn maybe_resolve_path(
12991299
&mut self,
13001300
path: &[Segment],
@@ -1304,7 +1304,7 @@ impl<'a> Resolver<'a> {
13041304
self.resolve_path_with_ribs(path, opt_ns, parent_scope, None, None, None)
13051305
}
13061306

1307-
#[tracing::instrument(level = "debug", skip(self))]
1307+
#[instrument(level = "debug", skip(self))]
13081308
pub(crate) fn resolve_path(
13091309
&mut self,
13101310
path: &[Segment],

0 commit comments

Comments
 (0)