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`
This commit is contained in:
commit
784316eadc
320 changed files with 375 additions and 287 deletions
|
@ -1,7 +1,7 @@
|
|||
use std::fmt;
|
||||
|
||||
use rustc_errors::{codes::*, DiagArgName, DiagArgValue, DiagMessage};
|
||||
use rustc_macros::Diagnostic;
|
||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||
use rustc_span::{Span, Symbol};
|
||||
|
||||
use crate::ty::Ty;
|
||||
|
|
|
@ -15,6 +15,7 @@ use rustc_data_structures::sync::{try_par_for_each_in, DynSend, DynSync};
|
|||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId};
|
||||
use rustc_hir::*;
|
||||
use rustc_macros::{Decodable, Encodable, HashStable};
|
||||
use rustc_span::{ErrorGuaranteed, ExpnId};
|
||||
|
||||
/// Gather the LocalDefId for each item-like within a module, including items contained within
|
||||
|
|
|
@ -2,6 +2,7 @@ use crate::ty;
|
|||
use crate::ty::Ty;
|
||||
|
||||
use rustc_hir::HirId;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
|
||||
use rustc_target::abi::{FieldIdx, VariantIdx};
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable)]
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::sync::Lock;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
|
||||
use rustc_type_ir::Canonical as IrCanonical;
|
||||
use rustc_type_ir::CanonicalVarInfo as IrCanonicalVarInfo;
|
||||
pub use rustc_type_ir::{CanonicalTyVarKind, CanonicalVarKind};
|
||||
|
|
|
@ -4,6 +4,7 @@ pub mod unify_key;
|
|||
use crate::ty::Region;
|
||||
use crate::ty::{OpaqueTypeKey, Ty};
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_macros::{HashStable, TypeFoldable, TypeVisitable};
|
||||
use rustc_span::Span;
|
||||
|
||||
/// Requires that `region` must be equal to one of the regions in `choice_regions`.
|
||||
|
|
|
@ -65,16 +65,8 @@
|
|||
#![allow(rustc::diagnostic_outside_of_impl)]
|
||||
#![allow(rustc::untranslatable_diagnostic)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate bitflags;
|
||||
#[macro_use]
|
||||
extern crate rustc_macros;
|
||||
#[macro_use]
|
||||
extern crate rustc_data_structures;
|
||||
#[macro_use]
|
||||
extern crate tracing;
|
||||
#[macro_use]
|
||||
extern crate smallvec;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
|
|
@ -4,6 +4,7 @@ use rustc_data_structures::fx::FxIndexMap;
|
|||
use rustc_data_structures::sorted_map::SortedMap;
|
||||
use rustc_errors::{Diag, DiagMessage, MultiSpan};
|
||||
use rustc_hir::{HirId, ItemLocalId};
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_session::lint::{
|
||||
builtin::{self, FORBIDDEN_LINT_GROUPS},
|
||||
FutureIncompatibilityReason, Level, Lint, LintId,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::ty;
|
||||
|
||||
use rustc_hir::def::Res;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_span::def_id::DefId;
|
||||
use rustc_span::symbol::Ident;
|
||||
use smallvec::SmallVec;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use crate::mir::mono::Linkage;
|
||||
use rustc_attr::{InlineAttr, InstructionSetAttr, OptimizeAttr};
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_target::abi::Align;
|
||||
use rustc_target::spec::SanitizerSet;
|
||||
|
@ -48,7 +49,7 @@ pub struct CodegenFnAttrs {
|
|||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, TyEncodable, TyDecodable, HashStable)]
|
||||
pub struct CodegenFnAttrFlags(u32);
|
||||
bitflags! {
|
||||
bitflags::bitflags! {
|
||||
impl CodegenFnAttrFlags: u32 {
|
||||
/// `#[cold]`: a hint to LLVM that this function, when called, is never on
|
||||
/// the hot path.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_macros::{Decodable, Encodable, HashStable};
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(HashStable)]
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
//! For all the gory details, see the provider of the `dependency_formats`
|
||||
//! query.
|
||||
|
||||
use rustc_macros::{Decodable, Encodable, HashStable};
|
||||
use rustc_session::config::CrateType;
|
||||
|
||||
/// A list of dependencies for a certain crate type.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::ty::GenericArgsRef;
|
||||
use crate::ty::{self, Ty, TyCtxt};
|
||||
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_macros::{Decodable, Encodable, HashStable, TyDecodable, TyEncodable};
|
||||
|
||||
/// The SymbolExportLevel of a symbols specifies from which kinds of crates
|
||||
/// the symbol will be exported. `C` symbols will be exported from any
|
||||
|
|
|
@ -5,6 +5,7 @@ pub mod exported_symbols;
|
|||
pub mod lang_items;
|
||||
pub mod lib_features {
|
||||
use rustc_data_structures::unord::UnordMap;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_span::{symbol::Symbol, Span};
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
|
|
|
@ -11,7 +11,7 @@ use rustc_data_structures::fx::FxIndexMap;
|
|||
use rustc_data_structures::unord::UnordMap;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::{HirId, HirIdMap, Node};
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
||||
use std::fmt;
|
||||
|
@ -153,7 +153,7 @@ rustc_index::newtype_index! {
|
|||
}
|
||||
|
||||
// compilation error if size of `ScopeData` is not the same as a `u32`
|
||||
static_assert_size!(ScopeData, 4);
|
||||
rustc_data_structures::static_assert_size!(ScopeData, 4);
|
||||
|
||||
impl Scope {
|
||||
/// Returns an item-local ID associated with this scope.
|
||||
|
|
|
@ -6,7 +6,7 @@ use rustc_data_structures::fx::FxIndexMap;
|
|||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::{ItemLocalId, OwnerId};
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_macros::{Decodable, Encodable, HashStable, TyDecodable, TyEncodable};
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, TyEncodable, TyDecodable, Debug, HashStable)]
|
||||
pub enum ResolvedArg {
|
||||
|
|
|
@ -14,6 +14,7 @@ use rustc_feature::GateIssue;
|
|||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId, LocalDefIdMap};
|
||||
use rustc_hir::{self as hir, HirId};
|
||||
use rustc_macros::{Decodable, Encodable, HashStable};
|
||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||
use rustc_session::lint::builtin::{DEPRECATED, DEPRECATED_IN_FUTURE, SOFT_UNSTABLE};
|
||||
use rustc_session::lint::{BuiltinLintDiag, Level, Lint, LintBuffer};
|
||||
|
|
|
@ -7,6 +7,7 @@ use rustc_data_structures::graph::dominators::{dominators, Dominators};
|
|||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_data_structures::sync::OnceLock;
|
||||
use rustc_index::{IndexSlice, IndexVec};
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
|
||||
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use std::fmt::{self, Debug, Display, Formatter};
|
||||
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_macros::{HashStable, Lift, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
|
||||
use rustc_session::{config::RemapPathScopeComponents, RemapFileNameExt};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use rustc_target::abi::{HasDataLayout, Size};
|
||||
|
@ -71,7 +72,7 @@ pub enum ConstValue<'tcx> {
|
|||
}
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
static_assert_size!(ConstValue<'_>, 24);
|
||||
rustc_data_structures::static_assert_size!(ConstValue<'_>, 24);
|
||||
|
||||
impl<'tcx> ConstValue<'tcx> {
|
||||
#[inline]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! Metadata from source code coverage analysis and instrumentation.
|
||||
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
|
||||
use rustc_span::{Span, Symbol};
|
||||
|
||||
use std::fmt::{self, Debug, Formatter};
|
||||
|
|
|
@ -14,6 +14,7 @@ use either::{Left, Right};
|
|||
|
||||
use rustc_ast::Mutability;
|
||||
use rustc_data_structures::intern::Interned;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_target::abi::{Align, HasDataLayout, Size};
|
||||
|
||||
use super::{
|
||||
|
|
|
@ -5,6 +5,7 @@ use std::hash;
|
|||
use std::iter;
|
||||
use std::ops::Range;
|
||||
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_serialize::{Decodable, Encodable};
|
||||
use rustc_target::abi::Size;
|
||||
use rustc_type_ir::{TyDecoder, TyEncoder};
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
use std::cmp;
|
||||
|
||||
use rustc_data_structures::sorted_map::SortedMap;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_target::abi::{HasDataLayout, Size};
|
||||
|
||||
use super::{alloc_range, AllocError, AllocRange, AllocResult, CtfeProvenance, Provenance};
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::ty::{self, layout, tls, Ty, TyCtxt, ValTree};
|
|||
use rustc_ast_ir::Mutability;
|
||||
use rustc_data_structures::sync::Lock;
|
||||
use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, ErrorGuaranteed, IntoDiagArg};
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_session::CtfeBacktrace;
|
||||
use rustc_span::{def_id::DefId, Span, DUMMY_SP};
|
||||
use rustc_target::abi::{call, Align, Size, VariantIdx, WrappingRange};
|
||||
|
@ -89,7 +89,7 @@ pub type EvalToConstValueResult<'tcx> = Result<ConstValue<'tcx>, ErrorHandled>;
|
|||
pub type EvalToValTreeResult<'tcx> = Result<Option<ValTree<'tcx>>, ErrorHandled>;
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
static_assert_size!(InterpErrorInfo<'_>, 8);
|
||||
rustc_data_structures::static_assert_size!(InterpErrorInfo<'_>, 8);
|
||||
|
||||
/// Packages the kind of error we got from the const code interpreter
|
||||
/// up with a Rust-level backtrace of where the error occurred.
|
||||
|
|
|
@ -131,7 +131,7 @@ use rustc_data_structures::sync::{HashMapExt, Lock};
|
|||
use rustc_data_structures::tiny_list::TinyList;
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
|
||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||
use rustc_serialize::{Decodable, Encodable};
|
||||
use rustc_target::abi::{AddressSpace, Endian, HasDataLayout};
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use super::{AllocId, InterpResult};
|
||||
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_data_structures::static_assert_size;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_target::abi::{HasDataLayout, Size};
|
||||
|
||||
use std::{fmt, num::NonZero};
|
||||
|
|
|
@ -6,7 +6,7 @@ use rustc_apfloat::{
|
|||
ieee::{Double, Half, Quad, Single},
|
||||
Float,
|
||||
};
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_target::abi::{HasDataLayout, Size};
|
||||
|
||||
use crate::ty::ScalarInt;
|
||||
|
@ -38,7 +38,7 @@ pub enum Scalar<Prov = CtfeProvenance> {
|
|||
}
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
static_assert_size!(Scalar, 24);
|
||||
rustc_data_structures::static_assert_size!(Scalar, 24);
|
||||
|
||||
// We want the `Debug` output to be readable as it is used by `derive(Debug)` for
|
||||
// all the Miri types.
|
||||
|
|
|
@ -20,6 +20,7 @@ use rustc_hir::def_id::{DefId, CRATE_DEF_ID};
|
|||
use rustc_hir::{
|
||||
self as hir, BindingMode, ByRef, CoroutineDesugaring, CoroutineKind, HirId, ImplicitSelfKind,
|
||||
};
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_target::abi::{FieldIdx, VariantIdx};
|
||||
|
|
|
@ -9,6 +9,7 @@ use rustc_data_structures::stable_hasher::{Hash128, HashStable, StableHasher};
|
|||
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
||||
use rustc_hir::ItemId;
|
||||
use rustc_index::Idx;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use rustc_session::config::OptLevel;
|
||||
use rustc_span::symbol::Symbol;
|
||||
|
|
|
@ -7,6 +7,7 @@ use rustc_errors::ErrorGuaranteed;
|
|||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_index::bit_set::BitMatrix;
|
||||
use rustc_index::{Idx, IndexVec};
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi::{FieldIdx, VariantIdx};
|
||||
|
|
|
@ -17,6 +17,7 @@ use rustc_data_structures::packed::Pu128;
|
|||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::CoroutineKind;
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_target::abi::{FieldIdx, VariantIdx};
|
||||
|
||||
|
@ -1522,6 +1523,7 @@ pub enum BinOp {
|
|||
#[cfg(target_pointer_width = "64")]
|
||||
mod size_asserts {
|
||||
use super::*;
|
||||
use rustc_data_structures::static_assert_size;
|
||||
// tidy-alphabetical-start
|
||||
static_assert_size!(AggregateKind<'_>, 32);
|
||||
static_assert_size!(Operand<'_>, 24);
|
||||
|
|
|
@ -15,7 +15,7 @@ pub struct PlaceTy<'tcx> {
|
|||
|
||||
// At least on 64 bit systems, `PlaceTy` should not be larger than two or three pointers.
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
static_assert_size!(PlaceTy<'_>, 16);
|
||||
rustc_data_structures::static_assert_size!(PlaceTy<'_>, 16);
|
||||
|
||||
impl<'tcx> PlaceTy<'tcx> {
|
||||
#[inline]
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/// Functionality for terminators and helper types that appear in terminators.
|
||||
use rustc_hir::LangItem;
|
||||
use smallvec::SmallVec;
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
|
||||
use super::TerminatorKind;
|
||||
use rustc_data_structures::packed::Pu128;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
|
||||
use std::slice;
|
||||
|
||||
use super::*;
|
||||
|
|
|
@ -72,6 +72,7 @@ use rustc_hir::def_id::{
|
|||
use rustc_hir::lang_items::{LangItem, LanguageItems};
|
||||
use rustc_hir::{Crate, ItemLocalId, ItemLocalMap, TraitCandidate};
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_macros::rustc_queries;
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use rustc_query_system::query::{try_get_cached, QueryCache, QueryMode, QueryState};
|
||||
use rustc_session::config::{EntryFnType, OptLevel, OutputFilenames, SymbolManglingVersion};
|
||||
|
|
|
@ -6,6 +6,7 @@ use rustc_data_structures::unord::{UnordMap, UnordSet};
|
|||
use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, StableCrateId, LOCAL_CRATE};
|
||||
use rustc_hir::definitions::DefPathHash;
|
||||
use rustc_index::{Idx, IndexVec};
|
||||
use rustc_macros::{Decodable, Encodable};
|
||||
use rustc_middle::dep_graph::{DepNodeIndex, SerializedDepNodeIndex};
|
||||
use rustc_middle::mir::interpret::{AllocDecodingSession, AllocDecodingState};
|
||||
use rustc_middle::mir::{self, interpret};
|
||||
|
|
|
@ -12,6 +12,7 @@ use rustc_data_structures::sync::AtomicU64;
|
|||
use rustc_data_structures::sync::WorkerLocal;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::hir_id::OwnerId;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_query_system::dep_graph::DepNodeIndex;
|
||||
use rustc_query_system::dep_graph::SerializedDepNodeIndex;
|
||||
pub(crate) use rustc_query_system::query::QueryJobId;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use super::*;
|
||||
|
||||
// FIXME(#27438): right now the unit tests of rustc_middle don't refer to any actual
|
||||
// functions generated in rustc_data_structures (all
|
||||
// references are through generic functions), but statics are
|
||||
|
|
|
@ -15,6 +15,7 @@ use rustc_hir::def_id::DefId;
|
|||
use rustc_hir::{BindingMode, ByRef, HirId, MatchSource, RangeEnd};
|
||||
use rustc_index::newtype_index;
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeVisitable};
|
||||
use rustc_middle::middle::region;
|
||||
use rustc_middle::mir::interpret::AllocId;
|
||||
use rustc_middle::mir::{self, BinOp, BorrowKind, FakeReadCause, UnOp};
|
||||
|
@ -1209,6 +1210,7 @@ impl<'tcx> fmt::Display for Pat<'tcx> {
|
|||
#[cfg(target_pointer_width = "64")]
|
||||
mod size_asserts {
|
||||
use super::*;
|
||||
use rustc_data_structures::static_assert_size;
|
||||
// tidy-alphabetical-start
|
||||
static_assert_size!(Block, 48);
|
||||
static_assert_size!(Expr<'_>, 64);
|
||||
|
|
|
@ -20,10 +20,13 @@ use rustc_errors::{Applicability, Diag, EmissionGuarantee};
|
|||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::HirId;
|
||||
use rustc_macros::{
|
||||
Decodable, Encodable, HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable,
|
||||
};
|
||||
use rustc_span::def_id::{LocalDefId, CRATE_DEF_ID};
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use smallvec::SmallVec;
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
@ -557,7 +560,7 @@ impl<'tcx> ObligationCauseCode<'tcx> {
|
|||
|
||||
// `ObligationCauseCode` is used a lot. Make sure it doesn't unintentionally get bigger.
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
static_assert_size!(ObligationCauseCode<'_>, 48);
|
||||
rustc_data_structures::static_assert_size!(ObligationCauseCode<'_>, 48);
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum StatementAsExpression {
|
||||
|
|
|
@ -10,11 +10,13 @@ use crate::infer::canonical::{Canonical, QueryResponse};
|
|||
use crate::ty::error::TypeError;
|
||||
use crate::ty::GenericArg;
|
||||
use crate::ty::{self, Ty, TyCtxt};
|
||||
use rustc_macros::{HashStable, TypeFoldable, TypeVisitable};
|
||||
use rustc_span::Span;
|
||||
|
||||
pub mod type_op {
|
||||
use crate::ty::fold::TypeFoldable;
|
||||
use crate::ty::{Predicate, Ty, TyCtxt, UserType};
|
||||
use rustc_macros::{HashStable, TypeFoldable, TypeVisitable};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, TypeVisitable)]
|
||||
|
|
|
@ -10,6 +10,7 @@ use rustc_errors::ErrorGuaranteed;
|
|||
use crate::ty;
|
||||
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_macros::{HashStable, TypeVisitable};
|
||||
use rustc_query_system::cache::Cache;
|
||||
|
||||
pub type SelectionCache<'tcx> = Cache<
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use rustc_ast_ir::try_visit;
|
||||
use rustc_data_structures::intern::Interned;
|
||||
use rustc_macros::{HashStable, TypeFoldable, TypeVisitable};
|
||||
use rustc_span::def_id::DefId;
|
||||
|
||||
use crate::infer::canonical::{CanonicalVarValues, QueryRegionConstraints};
|
||||
|
|
|
@ -24,6 +24,7 @@ use super::{
|
|||
};
|
||||
use crate::{infer::canonical::CanonicalVarValues, ty};
|
||||
use format::ProofTreeFormatter;
|
||||
use rustc_macros::{TypeFoldable, TypeVisitable};
|
||||
use std::fmt::{Debug, Write};
|
||||
|
||||
mod format;
|
||||
|
|
|
@ -5,6 +5,7 @@ use crate::ty::{self, TyCtxt};
|
|||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_hir::def_id::{DefId, DefIdMap};
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_span::symbol::sym;
|
||||
|
||||
/// A per-trait graph of impls in specialization order. At the moment, this
|
||||
|
|
|
@ -4,6 +4,7 @@ use crate::ty::{
|
|||
TypeVisitableExt,
|
||||
};
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeVisitable};
|
||||
|
||||
#[derive(Hash, Debug, Clone, Copy, Ord, PartialOrd, PartialEq, Eq)]
|
||||
#[derive(TyDecodable, TyEncodable, HashStable, TypeVisitable, TypeFoldable)]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::ty::{self, Ty, TyCtxt};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::lang_items::LangItem;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi::FieldIdx;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ use rustc_hir as hir;
|
|||
use rustc_hir::def::{CtorKind, DefKind, Res};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_index::{IndexSlice, IndexVec};
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use rustc_session::DataTypeKind;
|
||||
use rustc_span::symbol::sym;
|
||||
|
@ -26,7 +27,7 @@ use super::{Destructor, FieldDef, GenericPredicates, Ty, TyCtxt, VariantDef, Var
|
|||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, HashStable, TyEncodable, TyDecodable)]
|
||||
pub struct AdtFlags(u16);
|
||||
bitflags! {
|
||||
bitflags::bitflags! {
|
||||
impl AdtFlags: u16 {
|
||||
const NO_ADT_FLAGS = 0;
|
||||
/// Indicates whether the ADT is an enum.
|
||||
|
@ -582,8 +583,7 @@ impl<'tcx> AdtDef<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[derive(HashStable)]
|
||||
#[derive(Clone, Copy, Debug, HashStable)]
|
||||
pub enum Representability {
|
||||
Representable,
|
||||
Infinite(ErrorGuaranteed),
|
||||
|
|
|
@ -3,6 +3,7 @@ use rustc_data_structures::sorted_map::SortedIndexMultiMap;
|
|||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Namespace};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_macros::{Decodable, Encodable, HashStable};
|
||||
use rustc_span::symbol::{Ident, Symbol};
|
||||
|
||||
use super::{TyCtxt, Visibility};
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
use crate::ty::{self, Ty};
|
||||
use rustc_middle::mir;
|
||||
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
|
||||
/// Types that are represented as ints.
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
|
|
|
@ -11,6 +11,7 @@ use rustc_data_structures::fx::FxIndexMap;
|
|||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_hir::HirId;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
|
||||
use rustc_span::def_id::LocalDefIdMap;
|
||||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::{Span, Symbol};
|
||||
|
|
|
@ -6,7 +6,7 @@ use rustc_error_messages::MultiSpan;
|
|||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_type_ir::ConstKind as IrConstKind;
|
||||
use rustc_type_ir::{ConstTy, IntoKind, TypeFlags, WithCachedTypeInfo};
|
||||
|
||||
|
@ -23,7 +23,7 @@ pub use valtree::*;
|
|||
pub type ConstKind<'tcx> = IrConstKind<TyCtxt<'tcx>>;
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
static_assert_size!(ConstKind<'_>, 32);
|
||||
rustc_data_structures::static_assert_size!(ConstKind<'_>, 32);
|
||||
|
||||
/// Use this rather than `ConstData`, whenever possible.
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable)]
|
||||
|
@ -63,7 +63,7 @@ pub struct ConstData<'tcx> {
|
|||
}
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
static_assert_size!(ConstData<'_>, 40);
|
||||
rustc_data_structures::static_assert_size!(ConstData<'_>, 40);
|
||||
|
||||
impl<'tcx> Const<'tcx> {
|
||||
#[inline]
|
||||
|
|
|
@ -4,7 +4,7 @@ use crate::ty::abstract_const::CastKind;
|
|||
use crate::ty::GenericArgsRef;
|
||||
use crate::ty::{self, visit::TypeVisitableExt as _, List, Ty, TyCtxt};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
|
||||
|
||||
/// An unevaluated (potentially generic) constant used in the type-system.
|
||||
#[derive(Copy, Clone, Eq, PartialEq, TyEncodable, TyDecodable)]
|
||||
|
@ -72,4 +72,4 @@ pub enum Expr<'tcx> {
|
|||
}
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
static_assert_size!(Expr<'_>, 24);
|
||||
rustc_data_structures::static_assert_size!(Expr<'_>, 24);
|
||||
|
|
|
@ -56,7 +56,7 @@ use rustc_hir::intravisit::Visitor;
|
|||
use rustc_hir::lang_items::LangItem;
|
||||
use rustc_hir::{HirId, Node, TraitCandidate};
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_query_system::dep_graph::DepNodeIndex;
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use rustc_serialize::opaque::{FileEncodeResult, FileEncoder};
|
||||
|
|
|
@ -4,6 +4,7 @@ use rustc_errors::pluralize;
|
|||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{CtorOf, DefKind};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_macros::{TypeFoldable, TypeVisitable};
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_target::spec::abi;
|
||||
use std::borrow::Cow;
|
||||
|
|
|
@ -2,6 +2,7 @@ use crate::mir::Mutability;
|
|||
use crate::ty::GenericArgKind;
|
||||
use crate::ty::{self, GenericArgsRef, Ty, TyCtxt, TypeVisitableExt};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use std::fmt::Debug;
|
||||
use std::hash::Hash;
|
||||
use std::iter;
|
||||
|
|
|
@ -11,7 +11,9 @@ use rustc_ast_ir::walk_visitable_list;
|
|||
use rustc_data_structures::intern::Interned;
|
||||
use rustc_errors::{DiagArgValue, IntoDiagArg};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_macros::{
|
||||
Decodable, Encodable, HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable,
|
||||
};
|
||||
use rustc_serialize::{Decodable, Encodable};
|
||||
use rustc_type_ir::WithCachedTypeInfo;
|
||||
use smallvec::SmallVec;
|
||||
|
|
|
@ -3,6 +3,7 @@ use crate::ty::{EarlyBinder, GenericArgsRef};
|
|||
use rustc_ast as ast;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_span::symbol::{kw, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use rustc_macros::HashStable;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use crate::ty::context::TyCtxt;
|
||||
|
|
|
@ -8,7 +8,9 @@ use rustc_hir::def::Namespace;
|
|||
use rustc_hir::def_id::{CrateNum, DefId};
|
||||
use rustc_hir::lang_items::LangItem;
|
||||
use rustc_index::bit_set::FiniteBitSet;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_macros::{
|
||||
Decodable, Encodable, HashStable, Lift, TyDecodable, TyEncodable, TypeVisitable,
|
||||
};
|
||||
use rustc_middle::ty::normalize_erasing_regions::NormalizationError;
|
||||
use rustc_span::def_id::LOCAL_CRATE;
|
||||
use rustc_span::Symbol;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use rustc_macros::{Decodable, Encodable, HashStable};
|
||||
use rustc_span::{def_id::DefId, Symbol};
|
||||
|
||||
use super::TyCtxt;
|
||||
|
|
|
@ -10,6 +10,7 @@ use rustc_errors::{
|
|||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_macros::{extension, HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_session::config::OptLevel;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::{ErrorGuaranteed, Span, DUMMY_SP};
|
||||
|
|
|
@ -47,7 +47,9 @@ use rustc_hir as hir;
|
|||
use rustc_hir::def::{CtorKind, CtorOf, DefKind, DocLinkResMap, LifetimeRes, Res};
|
||||
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, LocalDefIdMap};
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_macros::{
|
||||
Decodable, Encodable, HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable,
|
||||
};
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use rustc_serialize::{Decodable, Encodable};
|
||||
use rustc_session::lint::LintBuffer;
|
||||
|
@ -1083,7 +1085,7 @@ struct ParamTag {
|
|||
reveal: traits::Reveal,
|
||||
}
|
||||
|
||||
impl_tag! {
|
||||
rustc_data_structures::impl_tag! {
|
||||
impl Tag for ParamTag;
|
||||
ParamTag { reveal: traits::Reveal::UserFacing },
|
||||
ParamTag { reveal: traits::Reveal::All },
|
||||
|
@ -1222,7 +1224,7 @@ pub struct Destructor {
|
|||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, HashStable, TyEncodable, TyDecodable)]
|
||||
pub struct VariantFlags(u8);
|
||||
bitflags! {
|
||||
bitflags::bitflags! {
|
||||
impl VariantFlags: u8 {
|
||||
const NO_VARIANT_FLAGS = 0;
|
||||
/// Indicates whether the field list of this variant is `#[non_exhaustive]`.
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
use crate::traits::query::NoSolution;
|
||||
use crate::ty::fold::{FallibleTypeFolder, TypeFoldable, TypeFolder};
|
||||
use crate::ty::{self, EarlyBinder, GenericArgsRef, Ty, TyCtxt, TypeVisitableExt};
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
|
||||
#[derive(Debug, Copy, Clone, HashStable, TyEncodable, TyDecodable)]
|
||||
pub enum NormalizationError<'tcx> {
|
||||
|
|
|
@ -2,6 +2,7 @@ use std::fmt;
|
|||
|
||||
use crate::ty;
|
||||
use rustc_data_structures::intern::Interned;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable)]
|
||||
#[rustc_pass_by_value]
|
||||
|
|
|
@ -3,6 +3,7 @@ use rustc_data_structures::intern::Interned;
|
|||
use rustc_errors::{DiagArgValue, IntoDiagArg};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::LangItem;
|
||||
use rustc_macros::{HashStable, Lift, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
|
||||
use rustc_span::Span;
|
||||
use rustc_type_ir::ClauseKind as IrClauseKind;
|
||||
use rustc_type_ir::PredicateKind as IrPredicateKind;
|
||||
|
|
|
@ -16,6 +16,7 @@ use rustc_hir::def::{self, CtorKind, DefKind, Namespace};
|
|||
use rustc_hir::def_id::{DefIdMap, DefIdSet, ModDefId, CRATE_DEF_ID, LOCAL_CRATE};
|
||||
use rustc_hir::definitions::{DefKey, DefPathDataName};
|
||||
use rustc_hir::LangItem;
|
||||
use rustc_macros::Lift;
|
||||
use rustc_session::cstore::{ExternCrate, ExternCrateSource};
|
||||
use rustc_session::Limit;
|
||||
use rustc_span::symbol::{kw, Ident, Symbol};
|
||||
|
|
|
@ -3,6 +3,7 @@ use rustc_data_structures::intern::Interned;
|
|||
use rustc_errors::MultiSpan;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_index::Idx;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::symbol::{kw, Symbol};
|
||||
use rustc_span::{ErrorGuaranteed, DUMMY_SP};
|
||||
|
|
|
@ -10,6 +10,7 @@ use crate::ty::{GenericArg, GenericArgKind, GenericArgsRef};
|
|||
use rustc_hir as hir;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_macros::TypeVisitable;
|
||||
use rustc_target::spec::abi;
|
||||
use std::iter;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use crate::middle::region::{Scope, ScopeData, ScopeTree};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::ItemLocalMap;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
|
||||
/// `RvalueScopes` is a mapping from sub-expressions to _extended_ lifetime as determined by
|
||||
/// rules laid out in `rustc_hir_analysis::check::rvalue_scopes`.
|
||||
|
|
|
@ -17,7 +17,7 @@ use rustc_errors::{DiagArgValue, ErrorGuaranteed, IntoDiagArg, MultiSpan};
|
|||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::LangItem;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_macros::{HashStable, Lift, TyDecodable, TyEncodable, TypeFoldable};
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use rustc_target::abi::{FieldIdx, VariantIdx, FIRST_VARIANT};
|
||||
|
|
|
@ -8,7 +8,7 @@ use std::iter;
|
|||
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_macros::{Decodable, Encodable, HashStable};
|
||||
|
||||
/// A trait's definition with type information.
|
||||
#[derive(HashStable, Encodable, Decodable)]
|
||||
|
|
|
@ -18,7 +18,7 @@ use rustc_hir::{
|
|||
BindingMode, ByRef, HirId, ItemLocalId, ItemLocalMap, ItemLocalSet, Mutability,
|
||||
};
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
|
||||
use rustc_middle::mir::FakeReadCause;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::Span;
|
||||
|
|
|
@ -17,12 +17,12 @@ use rustc_hir as hir;
|
|||
use rustc_hir::def::{CtorOf, DefKind, Res};
|
||||
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId};
|
||||
use rustc_index::bit_set::GrowableBitSet;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_macros::{extension, HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_session::Limit;
|
||||
use rustc_span::sym;
|
||||
use rustc_target::abi::{Integer, IntegerType, Primitive, Size};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use smallvec::SmallVec;
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use std::{fmt, iter};
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
|
|
|
@ -3,6 +3,7 @@ use std::fmt;
|
|||
use crate::mir::interpret::{alloc_range, AllocId, Allocation, Pointer, Scalar};
|
||||
use crate::ty::{self, Instance, PolyTraitRef, Ty, TyCtxt};
|
||||
use rustc_ast::Mutability;
|
||||
use rustc_macros::HashStable;
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, HashStable)]
|
||||
pub enum VtblEntry<'tcx> {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
use crate::ty::{self, Ty};
|
||||
use crate::ty::{GenericArg, GenericArgKind};
|
||||
use rustc_data_structures::sso::SsoHashSet;
|
||||
use smallvec::SmallVec;
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
|
||||
// The TypeWalker's stack is hot enough that it's worth going to some effort to
|
||||
// avoid heap allocations.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue