Skip to content

Commit 6341935

Browse files
committed
Remove extern crate tracing from numerous crates.
1 parent 52e9a23 commit 6341935

File tree

47 files changed

+47
-70
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+47
-70
lines changed

compiler/rustc_ast/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
#![feature(negative_impls)]
2121
#![feature(stmt_expr_attributes)]
2222

23-
#[macro_use]
24-
extern crate tracing;
25-
2623
pub mod util {
2724
pub mod case;
2825
pub mod classify;

compiler/rustc_ast/src/util/literal.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use rustc_lexer::unescape::{
88
use rustc_span::symbol::{kw, sym, Symbol};
99
use rustc_span::Span;
1010
use std::{ascii, fmt, str};
11+
use tracing::debug;
1112

1213
// Escapes a string, represented as a symbol. Reuses the original symbol,
1314
// avoiding interning, if no changes are required.

compiler/rustc_ast_lowering/src/index.rs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use rustc_index::IndexVec;
77
use rustc_middle::span_bug;
88
use rustc_middle::ty::TyCtxt;
99
use rustc_span::{Span, DUMMY_SP};
10+
use tracing::{debug, instrument};
1011

1112
/// A visitor that walks over the HIR and collects `Node`s into a HIR map.
1213
struct NodeCollector<'a, 'hir> {

compiler/rustc_ast_lowering/src/item.rs

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use rustc_span::{DesugaringKind, Span, Symbol};
2020
use rustc_target::spec::abi;
2121
use smallvec::{smallvec, SmallVec};
2222
use thin_vec::ThinVec;
23+
use tracing::instrument;
2324

2425
pub(super) struct ItemLowerer<'a, 'hir> {
2526
pub(super) tcx: TyCtxt<'hir>,

compiler/rustc_ast_lowering/src/lib.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,7 @@
3737
#![feature(box_patterns)]
3838
#![feature(let_chains)]
3939

40-
#[macro_use]
41-
extern crate tracing;
42-
4340
use crate::errors::{AssocTyParentheses, AssocTyParenthesesSub, MisplacedImplTrait};
44-
4541
use rustc_ast::node_id::NodeMap;
4642
use rustc_ast::ptr::P;
4743
use rustc_ast::{self as ast, *};
@@ -69,6 +65,7 @@ use rustc_span::{DesugaringKind, Span, DUMMY_SP};
6965
use smallvec::{smallvec, SmallVec};
7066
use std::collections::hash_map::Entry;
7167
use thin_vec::ThinVec;
68+
use tracing::{debug, instrument, trace};
7269

7370
macro_rules! arena_vec {
7471
($this:expr; $($x:expr),*) => (

compiler/rustc_ast_lowering/src/path.rs

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use rustc_span::symbol::{kw, sym, Ident};
1818
use rustc_span::{BytePos, DesugaringKind, Span, Symbol, DUMMY_SP};
1919

2020
use smallvec::{smallvec, SmallVec};
21+
use tracing::{debug, instrument};
2122

2223
impl<'a, 'hir> LoweringContext<'a, 'hir> {
2324
#[instrument(level = "trace", skip(self))]

compiler/rustc_builtin_macros/src/cfg_eval.rs

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use rustc_session::Session;
1818
use rustc_span::symbol::sym;
1919
use rustc_span::Span;
2020
use smallvec::SmallVec;
21+
use tracing::instrument;
2122

2223
pub(crate) fn expand(
2324
ecx: &mut ExtCtxt<'_>,

compiler/rustc_builtin_macros/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@
1919

2020
extern crate proc_macro;
2121

22-
#[macro_use]
23-
extern crate tracing;
24-
2522
use crate::deriving::*;
26-
2723
use rustc_expand::base::{MacroExpanderFn, ResolverExpand, SyntaxExtensionKind};
2824
use rustc_expand::proc_macro::BangProcMacro;
2925
use rustc_span::symbol::sym;

compiler/rustc_builtin_macros/src/test.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use rustc_span::{ErrorGuaranteed, FileNameDisplayPreference, Span};
1212
use std::assert_matches::assert_matches;
1313
use std::iter;
1414
use thin_vec::{thin_vec, ThinVec};
15+
use tracing::debug;
1516

1617
/// #[test_case] is used by custom test authors to mark tests
1718
/// When building for test, it needs to make the item public and gensym the name

compiler/rustc_driver_impl/src/lib.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
#![feature(panic_update_hook)]
1515
#![feature(result_flattening)]
1616

17-
#[macro_use]
18-
extern crate tracing;
19-
2017
use rustc_ast as ast;
2118
use rustc_codegen_ssa::{traits::CodegenBackend, CodegenErrors, CodegenResults};
2219
use rustc_const_eval::CTRL_C_RECEIVED;
@@ -46,7 +43,6 @@ use rustc_span::symbol::sym;
4643
use rustc_span::FileName;
4744
use rustc_target::json::ToJson;
4845
use rustc_target::spec::{Target, TargetTriple};
49-
5046
use std::cmp::max;
5147
use std::collections::BTreeMap;
5248
use std::env;
@@ -62,6 +58,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
6258
use std::sync::{Arc, OnceLock};
6359
use std::time::{Instant, SystemTime};
6460
use time::OffsetDateTime;
61+
use tracing::trace;
6562

6663
#[allow(unused_macros)]
6764
macro do_not_use_print($($t:tt)*) {

compiler/rustc_driver_impl/src/pretty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ use rustc_session::Session;
1313
use rustc_smir::rustc_internal::pretty::write_smir_pretty;
1414
use rustc_span::symbol::Ident;
1515
use rustc_span::FileName;
16-
1716
use std::cell::Cell;
1817
use std::fmt::Write;
18+
use tracing::debug;
1919

2020
pub use self::PpMode::*;
2121
pub use self::PpSourceMode::*;

compiler/rustc_errors/src/diagnostic.rs

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use std::marker::PhantomData;
1818
use std::ops::{Deref, DerefMut};
1919
use std::panic;
2020
use std::thread::panicking;
21+
use tracing::debug;
2122

2223
/// Error type for `DiagInner`'s `suggestions` field, indicating that
2324
/// `.disable_suggestions()` was called on the `DiagInner`.

compiler/rustc_errors/src/emitter.rs

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ use std::iter;
3535
use std::path::Path;
3636
use termcolor::{Buffer, BufferWriter, ColorChoice, ColorSpec, StandardStream};
3737
use termcolor::{Color, WriteColor};
38+
use tracing::{debug, instrument, trace, warn};
3839

3940
/// Default column width, used in tests and when terminal dimensions cannot be determined.
4041
const DEFAULT_COLUMN_WIDTH: usize = 140;

compiler/rustc_errors/src/lib.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@
2525
#![feature(yeet_expr)]
2626
// tidy-alphabetical-end
2727

28-
#[macro_use]
29-
extern crate tracing;
30-
3128
extern crate self as rustc_errors;
3229

3330
pub use codes::*;
@@ -74,6 +71,7 @@ use std::num::NonZero;
7471
use std::ops::DerefMut;
7572
use std::panic;
7673
use std::path::{Path, PathBuf};
74+
use tracing::debug;
7775

7876
use Level::*;
7977

compiler/rustc_errors/src/translation.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ pub use rustc_error_messages::FluentArgs;
66
use std::borrow::Cow;
77
use std::env;
88
use std::error::Report;
9+
use tracing::{debug, trace};
910

1011
/// Convert diagnostic arguments (a rustc internal type that exists to implement
1112
/// `Encodable`/`Decodable`) into `FluentArgs` which is necessary to perform translation.

compiler/rustc_expand/src/config.rs

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use rustc_session::Session;
2020
use rustc_span::symbol::{sym, Symbol};
2121
use rustc_span::Span;
2222
use thin_vec::ThinVec;
23+
use tracing::instrument;
2324

2425
/// A folder that strips out items that do not belong in the current configuration.
2526
pub struct StripUnconfigured<'a> {

compiler/rustc_expand/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
#![allow(rustc::diagnostic_outside_of_impl)]
1717
#![allow(internal_features)]
1818

19-
#[macro_use]
20-
extern crate tracing;
21-
2219
extern crate proc_macro as pm;
2320

2421
mod placeholders;

compiler/rustc_expand/src/mbe/diagnostics.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use rustc_span::source_map::SourceMap;
1414
use rustc_span::symbol::Ident;
1515
use rustc_span::{ErrorGuaranteed, Span};
1616
use std::borrow::Cow;
17+
use tracing::debug;
1718

1819
use super::macro_rules::{parser_from_cx, NoopTracker};
1920

compiler/rustc_expand/src/mbe/macro_rules.rs

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use rustc_span::edition::Edition;
2929
use rustc_span::hygiene::Transparency;
3030
use rustc_span::symbol::{kw, sym, Ident, MacroRulesNormalizedIdent};
3131
use rustc_span::Span;
32+
use tracing::{debug, instrument, trace, trace_span};
3233

3334
use std::borrow::Cow;
3435
use std::collections::hash_map::Entry;

compiler/rustc_hir/src/definitions.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77
pub use crate::def_id::DefPathHash;
88
use crate::def_id::{CrateNum, DefIndex, LocalDefId, StableCrateId, CRATE_DEF_INDEX, LOCAL_CRATE};
99
use crate::def_path_hash_map::DefPathHashMap;
10-
1110
use rustc_data_structures::stable_hasher::{Hash64, StableHasher};
1211
use rustc_data_structures::unord::UnordMap;
1312
use rustc_index::IndexVec;
1413
use rustc_macros::{Decodable, Encodable};
1514
use rustc_span::symbol::{kw, sym, Symbol};
16-
1715
use std::fmt::{self, Write};
1816
use std::hash::Hash;
17+
use tracing::{debug, instrument};
1918

2019
/// The `DefPathTable` maps `DefIndex`es to `DefKey`s and vice versa.
2120
/// Internally the `DefPathTable` holds a tree of `DefKey`s, where each `DefKey`

compiler/rustc_hir/src/hir.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use crate::def_id::{DefId, LocalDefIdMap};
33
pub(crate) use crate::hir_id::{HirId, ItemLocalId, ItemLocalMap, OwnerId};
44
use crate::intravisit::FnKind;
55
use crate::LangItem;
6-
76
use rustc_ast as ast;
87
use rustc_ast::util::parser::ExprPrecedence;
98
use rustc_ast::{Attribute, FloatTy, IntTy, Label, LitKind, TraitObjectSyntax, UintTy};
@@ -21,9 +20,9 @@ use rustc_span::ErrorGuaranteed;
2120
use rustc_span::{def_id::LocalDefId, BytePos, Span, DUMMY_SP};
2221
use rustc_target::asm::InlineAsmRegOrRegClass;
2322
use rustc_target::spec::abi::Abi;
24-
2523
use smallvec::SmallVec;
2624
use std::fmt;
25+
use tracing::debug;
2726

2827
#[derive(Debug, Copy, Clone, HashStable_Generic)]
2928
pub struct Lifetime {

compiler/rustc_hir/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
#![feature(variant_count)]
1111
#![allow(internal_features)]
1212

13-
#[macro_use]
14-
extern crate tracing;
15-
1613
extern crate self as rustc_hir;
1714

1815
mod arena;

compiler/rustc_pattern_analysis/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ pub mod pat_column;
1414
pub mod rustc;
1515
pub mod usefulness;
1616

17-
#[macro_use]
18-
extern crate tracing;
19-
2017
#[cfg(feature = "rustc")]
2118
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
2219

compiler/rustc_pattern_analysis/src/lints.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
use rustc_session::lint::builtin::NON_EXHAUSTIVE_OMITTED_PATTERNS;
2-
use rustc_span::ErrorGuaranteed;
3-
41
use crate::constructor::Constructor;
52
use crate::errors::{NonExhaustiveOmittedPattern, NonExhaustiveOmittedPatternLintOnArm, Uncovered};
63
use crate::pat_column::PatternColumn;
74
use crate::rustc::{RevealedTy, RustcPatCtxt, WitnessPat};
85
use crate::MatchArm;
6+
use rustc_session::lint::builtin::NON_EXHAUSTIVE_OMITTED_PATTERNS;
7+
use rustc_span::ErrorGuaranteed;
8+
use tracing::instrument;
99

1010
/// Traverse the patterns to collect any variants of a non_exhaustive enum that fail to be mentioned
1111
/// in a given column.

compiler/rustc_pattern_analysis/src/usefulness.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -709,16 +709,15 @@
709709
//! I (Nadrieril) prefer to put new tests in `ui/pattern/usefulness` unless there's a specific
710710
//! reason not to, for example if they crucially depend on a particular feature like `or_patterns`.
711711
712+
use self::PlaceValidity::*;
713+
use crate::constructor::{Constructor, ConstructorSet, IntRange};
714+
use crate::pat::{DeconstructedPat, PatId, PatOrWild, WitnessPat};
715+
use crate::{Captures, MatchArm, PatCx, PrivateUninhabitedField};
712716
use rustc_hash::FxHashSet;
713717
use rustc_index::bit_set::BitSet;
714718
use smallvec::{smallvec, SmallVec};
715719
use std::fmt;
716-
717-
use crate::constructor::{Constructor, ConstructorSet, IntRange};
718-
use crate::pat::{DeconstructedPat, PatId, PatOrWild, WitnessPat};
719-
use crate::{Captures, MatchArm, PatCx, PrivateUninhabitedField};
720-
721-
use self::PlaceValidity::*;
720+
use tracing::{debug, instrument};
722721

723722
#[cfg(feature = "rustc")]
724723
use rustc_data_structures::stack::ensure_sufficient_stack;

compiler/rustc_privacy/src/lib.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
#![feature(try_blocks)]
77
#![feature(let_chains)]
88

9-
#[macro_use]
10-
extern crate tracing;
11-
129
mod errors;
1310

1411
use rustc_ast::visit::{try_visit, VisitorResult};
@@ -31,6 +28,7 @@ use rustc_session::lint;
3128
use rustc_span::hygiene::Transparency;
3229
use rustc_span::symbol::{kw, sym, Ident};
3330
use rustc_span::Span;
31+
use tracing::debug;
3432

3533
use std::fmt;
3634
use std::marker::PhantomData;

compiler/rustc_query_system/src/dep_graph/graph.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use std::hash::Hash;
1515
use std::marker::PhantomData;
1616
use std::sync::atomic::Ordering;
1717
use std::sync::Arc;
18+
use tracing::{debug, instrument};
1819

1920
use super::query::DepGraphQuery;
2021
use super::serialized::{GraphEncoder, SerializedDepGraph, SerializedDepNodeIndex};

compiler/rustc_query_system/src/dep_graph/mod.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ pub use graph::{hash_result, DepGraph, DepNodeIndex, TaskDepsRef, WorkProduct, W
1111
pub use query::DepGraphQuery;
1212
pub use serialized::{SerializedDepGraph, SerializedDepNodeIndex};
1313

14+
use self::graph::{print_markframe_trace, MarkFrame};
1415
use crate::ich::StableHashingContext;
1516
use rustc_data_structures::profiling::SelfProfilerRef;
1617
use rustc_session::Session;
17-
1818
use std::panic;
19-
20-
use self::graph::{print_markframe_trace, MarkFrame};
19+
use tracing::instrument;
2120

2221
pub trait DepContext: Copy {
2322
type Deps: Deps;

compiler/rustc_query_system/src/dep_graph/serialized.rs

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
5151
use std::iter;
5252
use std::marker::PhantomData;
5353
use std::sync::Arc;
54+
use tracing::{debug, instrument};
5455

5556
// The maximum value of `SerializedDepNodeIndex` leaves the upper two bits
5657
// unused so that we can store multiple index types in `CompressedHybridIndex`,

compiler/rustc_query_system/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
#![feature(let_chains)]
66
#![allow(rustc::potential_query_instability, internal_features)]
77

8-
#[macro_use]
9-
extern crate tracing;
10-
118
pub mod cache;
129
pub mod dep_graph;
1310
mod error;

compiler/rustc_query_system/src/query/plumbing.rs

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use std::fmt::Debug;
2727
use std::hash::Hash;
2828
use std::mem;
2929
use thin_vec::ThinVec;
30+
use tracing::instrument;
3031

3132
use super::QueryConfig;
3233

compiler/rustc_session/src/config.rs

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use std::iter;
3333
use std::path::{Path, PathBuf};
3434
use std::str::{self, FromStr};
3535
use std::sync::LazyLock;
36+
use tracing::debug;
3637

3738
mod cfg;
3839
pub mod sigpipe;

compiler/rustc_session/src/filesearch.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
//! A module for searching for libraries
22
3-
use rustc_fs_util::try_canonicalize;
3+
use crate::search_paths::{PathKind, SearchPath};
4+
use rustc_fs_util::{fix_windows_verbatim_for_gcc, try_canonicalize};
45
use smallvec::{smallvec, SmallVec};
56
use std::env;
67
use std::fs;
78
use std::path::{Path, PathBuf};
8-
9-
use crate::search_paths::{PathKind, SearchPath};
10-
use rustc_fs_util::fix_windows_verbatim_for_gcc;
9+
use tracing::debug;
1110

1211
#[derive(Clone)]
1312
pub struct FileSearch<'a> {

compiler/rustc_session/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88

99
pub mod errors;
1010

11-
#[macro_use]
12-
extern crate tracing;
13-
1411
pub mod utils;
1512
pub use lint::{declare_lint, declare_lint_pass, declare_tool_lint, impl_lint_pass};
1613
pub use rustc_lint_defs as lint;

0 commit comments

Comments
 (0)