Skip to content

Commit 784316e

Browse files
authored
Rollup merge of #124511 - nnethercote:rm-extern-crates, r=fee1-dead
Remove many `#[macro_use] extern crate foo` items This requires the addition of more `use` items, which often make the code more verbose. But they also make the code easier to read, because `#[macro_use]` obscures where macros are defined. r? `@fee1-dead`
2 parents 7427812 + 2088de2 commit 784316e

File tree

320 files changed

+375
-287
lines changed

Some content is hidden

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

320 files changed

+375
-287
lines changed

compiler/rustc_ast/src/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use rustc_data_structures::packed::Pu128;
3232
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
3333
use rustc_data_structures::stack::ensure_sufficient_stack;
3434
use rustc_data_structures::sync::Lrc;
35-
use rustc_macros::HashStable_Generic;
35+
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
3636
use rustc_span::source_map::{respan, Spanned};
3737
use rustc_span::symbol::{kw, sym, Ident, Symbol};
3838
use rustc_span::{ErrorGuaranteed, Span, DUMMY_SP};

compiler/rustc_ast/src/expand/allocator.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use rustc_macros::HashStable_Generic;
12
use rustc_span::symbol::{sym, Symbol};
23

34
#[derive(Clone, Debug, Copy, Eq, PartialEq, HashStable_Generic)]

compiler/rustc_ast/src/expand/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! Definitions shared by macros / syntax extensions and e.g. `rustc_middle`.
22
3+
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
34
use rustc_span::{def_id::DefId, symbol::Ident};
45

56
use crate::MetaItem;

compiler/rustc_ast/src/format.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::ptr::P;
22
use crate::Expr;
33
use rustc_data_structures::fx::FxHashMap;
4+
use rustc_macros::{Decodable, Encodable};
45
use rustc_span::symbol::{Ident, Symbol};
56
use rustc_span::Span;
67

compiler/rustc_ast/src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@
2020
#![feature(negative_impls)]
2121
#![feature(stmt_expr_attributes)]
2222

23-
#[macro_use]
24-
extern crate rustc_macros;
25-
26-
#[macro_use]
27-
extern crate tracing;
28-
2923
pub mod util {
3024
pub mod case;
3125
pub mod classify;

compiler/rustc_ast/src/token.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::util::case::Case;
99

1010
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
1111
use rustc_data_structures::sync::Lrc;
12-
use rustc_macros::HashStable_Generic;
12+
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
1313
use rustc_span::symbol::{kw, sym};
1414
#[allow(clippy::useless_attribute)] // FIXME: following use of `hidden_glob_reexports` incorrectly triggers `useless_attribute` lint.
1515
#[allow(hidden_glob_reexports)]

compiler/rustc_ast/src/tokenstream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use crate::AttrVec;
2020

2121
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
2222
use rustc_data_structures::sync::{self, Lrc};
23-
use rustc_macros::HashStable_Generic;
23+
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
2424
use rustc_serialize::{Decodable, Encodable};
2525
use rustc_span::{sym, Span, SpanDecoder, SpanEncoder, Symbol, DUMMY_SP};
2626
use smallvec::{smallvec, SmallVec};

compiler/rustc_ast/src/util/literal.rs

Lines changed: 1 addition & 0 deletions
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_ir/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
#![cfg_attr(feature = "nightly", allow(internal_features))]
44

55
#[cfg(feature = "nightly")]
6-
#[macro_use]
7-
extern crate rustc_macros;
6+
use rustc_macros::{Decodable, Encodable, HashStable_NoContext};
87

98
pub mod visit;
109

compiler/rustc_ast_lowering/src/index.rs

Lines changed: 1 addition & 0 deletions
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> {

0 commit comments

Comments
 (0)