Skip to content

Commit 4814fd0

Browse files
committed
Remove extern crate rustc_macros from numerous crates.
1 parent 10505a1 commit 4814fd0

File tree

110 files changed

+99
-94
lines changed

Some content is hidden

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

110 files changed

+99
-94
lines changed

compiler/rustc_ast/src/ast.rs

+1-1
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

+1
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

+1
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

+1
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

-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 rustc_macros;
25-
2623
#[macro_use]
2724
extern crate tracing;
2825

compiler/rustc_ast/src/token.rs

+1-1
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

+1-1
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_ir/src/lib.rs

+1-2
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_attr/src/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc_ast::{Attribute, LitKind, MetaItem, MetaItemKind, MetaItemLit, NestedM
66
use rustc_ast_pretty::pprust;
77
use rustc_errors::ErrorGuaranteed;
88
use rustc_feature::{find_gated_cfg, is_builtin_attr_name, Features, GatedCfg};
9-
use rustc_macros::HashStable_Generic;
9+
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
1010
use rustc_session::config::ExpectedValues;
1111
use rustc_session::lint::builtin::UNEXPECTED_CFGS;
1212
use rustc_session::lint::BuiltinLintDiag;

compiler/rustc_attr/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
#![doc(rust_logo)]
1010
#![feature(let_chains)]
1111

12-
#[macro_use]
13-
extern crate rustc_macros;
14-
1512
mod builtin;
1613
mod session_diagnostics;
1714

compiler/rustc_attr/src/session_diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::num::IntErrorKind;
22

33
use rustc_ast as ast;
44
use rustc_errors::{codes::*, Applicability, Diag, DiagCtxt, Diagnostic, EmissionGuarantee, Level};
5-
use rustc_macros::Diagnostic;
5+
use rustc_macros::{Diagnostic, Subdiagnostic};
66
use rustc_span::{Span, Symbol};
77

88
use crate::fluent_generated as fluent;

compiler/rustc_codegen_llvm/src/debuginfo/metadata/type_map.rs

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use rustc_data_structures::{
55
fx::FxHashMap,
66
stable_hasher::{HashStable, StableHasher},
77
};
8+
use rustc_macros::HashStable;
89
use rustc_middle::{
910
bug,
1011
ty::{ParamEnv, PolyExistentialTraitRef, Ty, TyCtxt},
@@ -23,6 +24,8 @@ use crate::{
2324
use super::{unknown_file_metadata, SmallVec, UNKNOWN_LINE_NUMBER};
2425

2526
mod private {
27+
use rustc_macros::HashStable;
28+
2629
// This type cannot be constructed outside of this module because
2730
// it has a private field. We make use of this in order to prevent
2831
// `UniqueTypeId` from being constructed directly, without asserting

compiler/rustc_codegen_llvm/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
#![feature(let_chains)]
1616
#![feature(impl_trait_in_assoc_type)]
1717

18-
#[macro_use]
19-
extern crate rustc_macros;
2018
#[macro_use]
2119
extern crate tracing;
2220

compiler/rustc_codegen_ssa/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
//! The backend-agnostic functions of this crate use functions defined in various traits that
1717
//! have to be implemented by each backend.
1818
19-
#[macro_use]
20-
extern crate rustc_macros;
2119
#[macro_use]
2220
extern crate tracing;
2321
#[macro_use]
@@ -29,6 +27,7 @@ use rustc_data_structures::fx::FxIndexMap;
2927
use rustc_data_structures::sync::Lrc;
3028
use rustc_data_structures::unord::UnordMap;
3129
use rustc_hir::def_id::CrateNum;
30+
use rustc_macros::{Decodable, Encodable, HashStable};
3231
use rustc_middle::dep_graph::WorkProduct;
3332
use rustc_middle::middle::debugger_visualizer::DebuggerVisualizerFile;
3433
use rustc_middle::middle::dependency_format::Dependencies;

compiler/rustc_data_structures/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@
4141

4242
#[macro_use]
4343
extern crate tracing;
44-
#[macro_use]
45-
extern crate rustc_macros;
4644

4745
use std::fmt;
4846

compiler/rustc_data_structures/src/sorted_map.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::stable_hasher::{HashStable, StableHasher, StableOrd};
2+
use rustc_macros::{Decodable_Generic, Encodable_Generic};
23
use std::borrow::Borrow;
34
use std::fmt::Debug;
45
use std::mem;

compiler/rustc_data_structures/src/svh.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
//! compiled from distinct sources.
77
88
use crate::fingerprint::Fingerprint;
9-
use std::fmt;
10-
119
use crate::stable_hasher;
10+
use rustc_macros::{Decodable_Generic, Encodable_Generic};
11+
use std::fmt;
1212

1313
#[derive(Copy, Clone, PartialEq, Eq, Debug, Encodable_Generic, Decodable_Generic, Hash)]
1414
pub struct Svh {

compiler/rustc_data_structures/src/unord.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
//! as required by the query system.
44
55
use rustc_hash::{FxHashMap, FxHashSet};
6+
use rustc_macros::{Decodable_Generic, Encodable_Generic};
67
use std::{
78
borrow::{Borrow, BorrowMut},
89
collections::hash_map::Entry,

compiler/rustc_errors/src/diagnostic.rs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use rustc_data_structures::fx::FxIndexMap;
77
use rustc_error_messages::fluent_value_from_str_list_sep_by_and;
88
use rustc_error_messages::FluentValue;
99
use rustc_lint_defs::{Applicability, LintExpectationId};
10+
use rustc_macros::{Decodable, Encodable};
1011
use rustc_span::source_map::Spanned;
1112
use rustc_span::symbol::Symbol;
1213
use rustc_span::{Span, DUMMY_SP};

compiler/rustc_errors/src/diagnostic_impls.rs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use crate::{
77
use rustc_ast as ast;
88
use rustc_ast_pretty::pprust;
99
use rustc_hir as hir;
10+
use rustc_macros::Subdiagnostic;
1011
use rustc_span::edition::Edition;
1112
use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent, Symbol};
1213
use rustc_span::Span;

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 rustc_macros;
30-
3128
#[macro_use]
3229
extern crate tracing;
3330

@@ -64,6 +61,7 @@ use rustc_data_structures::stable_hasher::{Hash128, StableHasher};
6461
use rustc_data_structures::sync::{Lock, Lrc};
6562
use rustc_data_structures::AtomicRef;
6663
use rustc_lint_defs::LintExpectationId;
64+
use rustc_macros::{Decodable, Encodable};
6765
use rustc_span::source_map::SourceMap;
6866
use rustc_span::{Loc, Span, DUMMY_SP};
6967
use std::backtrace::{Backtrace, BacktraceStatus};

compiler/rustc_errors/src/snippet.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Code for annotating snippets.
22

33
use crate::{Level, Loc};
4+
use rustc_macros::{Decodable, Encodable};
45

56
#[derive(Clone, Debug, PartialOrd, Ord, PartialEq, Eq)]
67
pub struct Line {

compiler/rustc_expand/src/errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rustc_ast::ast;
22
use rustc_errors::codes::*;
3-
use rustc_macros::Diagnostic;
3+
use rustc_macros::{Diagnostic, Subdiagnostic};
44
use rustc_session::Limit;
55
use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent};
66
use rustc_span::{Span, Symbol};

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 rustc_macros;
21-
2219
#[macro_use]
2320
extern crate tracing;
2421

compiler/rustc_expand/src/mbe.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub(crate) mod transcribe;
1414
use metavar_expr::MetaVarExpr;
1515
use rustc_ast::token::{Delimiter, NonterminalKind, Token, TokenKind};
1616
use rustc_ast::tokenstream::{DelimSpacing, DelimSpan};
17+
use rustc_macros::{Decodable, Encodable};
1718
use rustc_span::symbol::Ident;
1819
use rustc_span::Span;
1920

compiler/rustc_expand/src/mbe/diagnostics.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use rustc_ast::token::{self, Token, TokenKind};
88
use rustc_ast::tokenstream::TokenStream;
99
use rustc_ast_pretty::pprust;
1010
use rustc_errors::{Applicability, Diag, DiagCtxt, DiagMessage};
11+
use rustc_macros::Subdiagnostic;
1112
use rustc_parse::parser::{Parser, Recovery};
1213
use rustc_span::source_map::SourceMap;
1314
use rustc_span::symbol::Ident;

compiler/rustc_expand/src/mbe/metavar_expr.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use rustc_ast::tokenstream::{RefTokenTreeCursor, TokenStream, TokenTree};
33
use rustc_ast::{LitIntType, LitKind};
44
use rustc_ast_pretty::pprust;
55
use rustc_errors::{Applicability, PResult};
6+
use rustc_macros::{Decodable, Encodable};
67
use rustc_session::parse::ParseSess;
78
use rustc_span::symbol::Ident;
89
use rustc_span::Span;

compiler/rustc_hir/src/def.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_ast as ast;
55
use rustc_ast::NodeId;
66
use rustc_data_structures::stable_hasher::ToStableHashKey;
77
use rustc_data_structures::unord::UnordMap;
8-
use rustc_macros::HashStable_Generic;
8+
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
99
use rustc_span::def_id::{DefId, LocalDefId};
1010
use rustc_span::hygiene::MacroKind;
1111
use rustc_span::symbol::kw;

compiler/rustc_hir/src/definitions.rs

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use crate::def_path_hash_map::DefPathHashMap;
1111
use rustc_data_structures::stable_hasher::{Hash64, StableHasher};
1212
use rustc_data_structures::unord::UnordMap;
1313
use rustc_index::IndexVec;
14+
use rustc_macros::{Decodable, Encodable};
1415
use rustc_span::symbol::{kw, sym, Symbol};
1516

1617
use std::fmt::{self, Write};

compiler/rustc_hir/src/hir.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
1313
use rustc_data_structures::fingerprint::Fingerprint;
1414
use rustc_data_structures::sorted_map::SortedMap;
1515
use rustc_index::IndexVec;
16-
use rustc_macros::HashStable_Generic;
16+
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
1717
use rustc_span::hygiene::MacroKind;
1818
use rustc_span::source_map::Spanned;
1919
use rustc_span::symbol::{kw, sym, Ident, Symbol};

compiler/rustc_hir/src/hir_id.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::def_id::{DefId, DefIndex, LocalDefId, CRATE_DEF_ID};
22
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableOrd, ToStableHashKey};
3+
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
34
use rustc_span::{def_id::DefPathHash, HashStableContext};
45
use std::fmt::{self, Debug};
56

compiler/rustc_hir/src/lang_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::{MethodKind, Target};
1212

1313
use rustc_ast as ast;
1414
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
15-
use rustc_macros::HashStable_Generic;
15+
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
1616
use rustc_span::symbol::{kw, sym, Symbol};
1717
use rustc_span::Span;
1818

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 rustc_macros;
15-
1613
#[macro_use]
1714
extern crate tracing;
1815

compiler/rustc_infer/src/infer/canonical/instantiate.rs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//! [c]: https://rust-lang.github.io/chalk/book/canonical_queries/canonicalization.html
88
99
use crate::infer::canonical::{Canonical, CanonicalVarValues};
10+
use rustc_macros::extension;
1011
use rustc_middle::ty::fold::{FnMutDelegate, TypeFoldable};
1112
use rustc_middle::ty::GenericArgKind;
1213
use rustc_middle::ty::{self, TyCtxt};

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

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ use rustc_hir::def::DefKind;
6868
use rustc_hir::def_id::{DefId, LocalDefId};
6969
use rustc_hir::intravisit::Visitor;
7070
use rustc_hir::lang_items::LangItem;
71+
use rustc_macros::extension;
7172
use rustc_middle::dep_graph::DepContext;
7273
use rustc_middle::ty::print::{with_forced_trimmed_paths, PrintError};
7374
use rustc_middle::ty::relate::{self, RelateResult, TypeRelation};

compiler/rustc_infer/src/infer/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pub use lexical_region_resolve::RegionResolutionError;
44
pub use relate::combine::CombineFields;
55
pub use relate::combine::ObligationEmittingRelation;
66
pub use relate::StructurallyRelateAliases;
7+
pub use rustc_macros::{TypeFoldable, TypeVisitable};
78
pub use rustc_middle::ty::IntVarValue;
89
pub use BoundRegionConversionTime::*;
910
pub use RegionVariableOrigin::*;
@@ -20,13 +21,13 @@ use opaque_types::OpaqueTypeStorage;
2021
use region_constraints::{GenericKind, VarInfos, VerifyBound};
2122
use region_constraints::{RegionConstraintCollector, RegionConstraintStorage};
2223
use rustc_data_structures::captures::Captures;
23-
use rustc_data_structures::fx::FxIndexMap;
24-
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
24+
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
2525
use rustc_data_structures::sync::Lrc;
2626
use rustc_data_structures::undo_log::Rollback;
2727
use rustc_data_structures::unify as ut;
2828
use rustc_errors::{Diag, DiagCtxt, ErrorGuaranteed};
2929
use rustc_hir::def_id::{DefId, LocalDefId};
30+
use rustc_macros::extension;
3031
use rustc_middle::infer::canonical::{Canonical, CanonicalVarValues};
3132
use rustc_middle::infer::unify_key::ConstVariableValue;
3233
use rustc_middle::infer::unify_key::EffectVarValue;

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

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use rustc_data_structures::sync::Lrc;
1111
use rustc_data_structures::undo_log::UndoLogs;
1212
use rustc_data_structures::unify as ut;
1313
use rustc_index::IndexVec;
14+
use rustc_macros::{TypeFoldable, TypeVisitable};
1415
use rustc_middle::infer::unify_key::{RegionVariableValue, RegionVidKey};
1516
use rustc_middle::ty::ReStatic;
1617
use rustc_middle::ty::{self, Ty, TyCtxt};

compiler/rustc_infer/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
#![feature(yeet_expr)]
3131
#![recursion_limit = "512"] // For rustdoc
3232

33-
#[macro_use]
34-
extern crate rustc_macros;
3533
#[cfg(target_pointer_width = "64")]
3634
#[macro_use]
3735
extern crate rustc_data_structures;

compiler/rustc_infer/src/traits/engine.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::infer::InferCtxt;
22
use crate::traits::Obligation;
33
use rustc_hir::def_id::DefId;
4+
use rustc_macros::extension;
45
use rustc_middle::ty::{self, ToPredicate, Ty};
56

67
use super::FulfillmentError;

compiler/rustc_lint_defs/src/lib.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#[macro_use]
2-
extern crate rustc_macros;
3-
41
pub use self::Level::*;
52
use rustc_ast::node_id::NodeId;
63
use rustc_ast::{AttrId, Attribute};
@@ -11,6 +8,7 @@ use rustc_data_structures::stable_hasher::{
118
use rustc_error_messages::{DiagMessage, MultiSpan};
129
use rustc_hir::HashStableContext;
1310
use rustc_hir::HirId;
11+
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
1412
use rustc_span::edition::Edition;
1513
use rustc_span::{sym, symbol::Ident, Span, Symbol};
1614
use rustc_target::spec::abi::Abi;

compiler/rustc_metadata/src/errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::{
44
};
55

66
use rustc_errors::{codes::*, Diag, DiagCtxt, Diagnostic, EmissionGuarantee, Level};
7-
use rustc_macros::Diagnostic;
7+
use rustc_macros::{Diagnostic, Subdiagnostic};
88
use rustc_session::config;
99
use rustc_span::{sym, Span, Symbol};
1010
use rustc_target::spec::{PanicStrategy, TargetTriple};

0 commit comments

Comments
 (0)