Rollup merge of #70318 - anyska:multiple-derives, r=Dylan-DPC

Split long derive lists into two derive attributes.
This commit is contained in:
Mazdak Farrokhzad 2020-03-23 19:04:57 +01:00 committed by GitHub
commit 5b29348cfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 78 additions and 484 deletions

View File

@ -489,19 +489,8 @@ impl<'tcx> DepNodeParams<'tcx> for HirId {
/// some independent path or string that persists between runs without
/// the need to be mapped or unmapped. (This ensures we can serialize
/// them even in the absence of a tcx.)
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
RustcEncodable,
RustcDecodable,
HashStable
)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
#[derive(HashStable)]
pub struct WorkProductId {
hash: Fingerprint,
}

View File

@ -40,18 +40,8 @@ impl CrateSource {
}
}
#[derive(
RustcEncodable,
RustcDecodable,
Copy,
Clone,
Ord,
PartialOrd,
Eq,
PartialEq,
Debug,
HashStable
)]
#[derive(RustcEncodable, RustcDecodable, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Debug)]
#[derive(HashStable)]
pub enum DepKind {
/// A dependency that is only used for its macros.
MacrosOnly,

View File

@ -80,18 +80,8 @@ use std::fmt;
// placate the same deriving in `ty::FreeRegion`, but we may want to
// actually attach a more meaningful ordering to scopes than the one
// generated via deriving here.
#[derive(
Clone,
PartialEq,
PartialOrd,
Eq,
Ord,
Hash,
Copy,
RustcEncodable,
RustcDecodable,
HashStable
)]
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, Copy, RustcEncodable, RustcDecodable)]
#[derive(HashStable)]
pub struct Scope {
pub id: hir::ItemLocalId,
pub data: ScopeData,
@ -114,19 +104,8 @@ impl fmt::Debug for Scope {
}
}
#[derive(
Clone,
PartialEq,
PartialOrd,
Eq,
Ord,
Hash,
Debug,
Copy,
RustcEncodable,
RustcDecodable,
HashStable
)]
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, Debug, Copy, RustcEncodable, RustcDecodable)]
#[derive(HashStable)]
pub enum ScopeData {
Node,

View File

@ -15,18 +15,8 @@ use std::ops::{Deref, DerefMut, Range};
// NOTE: When adding new fields, make sure to adjust the `Snapshot` impl in
// `src/librustc_mir/interpret/snapshot.rs`.
#[derive(
Clone,
Debug,
Eq,
PartialEq,
PartialOrd,
Ord,
Hash,
RustcEncodable,
RustcDecodable,
HashStable
)]
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
#[derive(HashStable)]
pub struct Allocation<Tag = (), Extra = ()> {
/// The actual bytes of the allocation.
/// Note that the bytes of a pointer represent the offset of the pointer.
@ -759,18 +749,8 @@ type Block = u64;
/// A bitmask where each bit refers to the byte with the same index. If the bit is `true`, the byte
/// is defined. If it is `false` the byte is undefined.
#[derive(
Clone,
Debug,
Eq,
PartialEq,
PartialOrd,
Ord,
Hash,
RustcEncodable,
RustcDecodable,
HashStable
)]
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
#[derive(HashStable)]
pub struct UndefMask {
blocks: Vec<Block>,
len: Size,

View File

@ -111,18 +111,8 @@ impl<T: layout::HasDataLayout> PointerArithmetic for T {}
///
/// `Pointer` is also generic over the `Tag` associated with each pointer,
/// which is used to do provenance tracking during execution.
#[derive(
Copy,
Clone,
Eq,
PartialEq,
Ord,
PartialOrd,
RustcEncodable,
RustcDecodable,
Hash,
HashStable
)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, RustcEncodable, RustcDecodable, Hash)]
#[derive(HashStable)]
pub struct Pointer<Tag = (), Id = AllocId> {
pub alloc_id: Id,
pub offset: Size,

View File

@ -23,19 +23,8 @@ pub struct RawConst<'tcx> {
/// Represents a constant value in Rust. `Scalar` and `Slice` are optimizations for
/// array length computations, enum discriminants and the pattern matching logic.
#[derive(
Copy,
Clone,
Debug,
Eq,
PartialEq,
PartialOrd,
Ord,
RustcEncodable,
RustcDecodable,
Hash,
HashStable
)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Hash)]
#[derive(HashStable)]
pub enum ConstValue<'tcx> {
/// Used only for types with `layout::abi::Scalar` ABI and ZSTs.
///
@ -98,18 +87,8 @@ impl<'tcx> ConstValue<'tcx> {
/// `memory::Allocation`. It is in many ways like a small chunk of a `Allocation`, up to 8 bytes in
/// size. Like a range of bytes in an `Allocation`, a `Scalar` can either represent the raw bytes
/// of a simple value or a pointer into another `Allocation`
#[derive(
Clone,
Copy,
Eq,
PartialEq,
Ord,
PartialOrd,
RustcEncodable,
RustcDecodable,
Hash,
HashStable
)]
#[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, RustcEncodable, RustcDecodable, Hash)]
#[derive(HashStable)]
pub enum Scalar<Tag = (), Id = AllocId> {
/// The raw bytes of a simple value.
Raw {

View File

@ -69,18 +69,8 @@ impl<'tcx> HasLocalDecls<'tcx> for Body<'tcx> {
/// The various "big phases" that MIR goes through.
///
/// Warning: ordering of variants is significant.
#[derive(
Copy,
Clone,
RustcEncodable,
RustcDecodable,
HashStable,
Debug,
PartialEq,
Eq,
PartialOrd,
Ord
)]
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug, PartialEq, Eq, PartialOrd, Ord)]
#[derive(HashStable)]
pub enum MirPhase {
Build = 0,
Const = 1,
@ -439,18 +429,8 @@ pub struct SourceInfo {
///////////////////////////////////////////////////////////////////////////
// Borrow kinds
#[derive(
Copy,
Clone,
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
RustcEncodable,
RustcDecodable,
HashStable
)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, RustcEncodable, RustcDecodable)]
#[derive(HashStable)]
pub enum BorrowKind {
/// Data must be immutable and is aliasable.
Shared,

View File

@ -2642,19 +2642,8 @@ impl<'tcx> FieldDef {
///
/// You can get the environment type of a closure using
/// `tcx.closure_env_ty()`.
#[derive(
Clone,
Copy,
PartialOrd,
Ord,
PartialEq,
Eq,
Hash,
Debug,
RustcEncodable,
RustcDecodable,
HashStable
)]
#[derive(Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)]
#[derive(HashStable)]
pub enum ClosureKind {
// Warning: Ordering is significant here! The ordering is chosen
// because the trait Fn is a subtrait of FnMut and so in turn, and

View File

@ -31,38 +31,15 @@ use std::cmp::Ordering;
use std::marker::PhantomData;
use std::ops::Range;
#[derive(
Clone,
Copy,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
Debug,
RustcEncodable,
RustcDecodable,
HashStable,
TypeFoldable,
Lift
)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)]
#[derive(HashStable, TypeFoldable, Lift)]
pub struct TypeAndMut<'tcx> {
pub ty: Ty<'tcx>,
pub mutbl: hir::Mutability,
}
#[derive(
Clone,
PartialEq,
PartialOrd,
Eq,
Ord,
Hash,
RustcEncodable,
RustcDecodable,
Copy,
HashStable
)]
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, RustcEncodable, RustcDecodable, Copy)]
#[derive(HashStable)]
/// A "free" region `fr` can be interpreted as "some region
/// at least as big as the scope `fr.scope`".
pub struct FreeRegion {
@ -70,18 +47,8 @@ pub struct FreeRegion {
pub bound_region: BoundRegion,
}
#[derive(
Clone,
PartialEq,
PartialOrd,
Eq,
Ord,
Hash,
RustcEncodable,
RustcDecodable,
Copy,
HashStable
)]
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, RustcEncodable, RustcDecodable, Copy)]
#[derive(HashStable)]
pub enum BoundRegion {
/// An anonymous region parameter for a given fn (&T)
BrAnon(u32),
@ -119,18 +86,8 @@ impl BoundRegion {
/// N.B., if you change this, you'll probably want to change the corresponding
/// AST structure in `librustc_ast/ast.rs` as well.
#[derive(
Clone,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
RustcEncodable,
RustcDecodable,
HashStable,
Debug
)]
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable, Debug)]
#[derive(HashStable)]
#[rustc_diagnostic_item = "TyKind"]
pub enum TyKind<'tcx> {
/// The primitive boolean type. Written as `bool`.
@ -1147,18 +1104,8 @@ impl<'tcx> PolyFnSig<'tcx> {
pub type CanonicalPolyFnSig<'tcx> = Canonical<'tcx, Binder<FnSig<'tcx>>>;
#[derive(
Clone,
Copy,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
RustcEncodable,
RustcDecodable,
HashStable
)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
#[derive(HashStable)]
pub struct ParamTy {
pub index: u32,
pub name: Symbol,
@ -1182,18 +1129,8 @@ impl<'tcx> ParamTy {
}
}
#[derive(
Copy,
Clone,
Hash,
RustcEncodable,
RustcDecodable,
Eq,
PartialEq,
Ord,
PartialOrd,
HashStable
)]
#[derive(Copy, Clone, Hash, RustcEncodable, RustcDecodable, Eq, PartialEq, Ord, PartialOrd)]
#[derive(HashStable)]
pub struct ParamConst {
pub index: u32,
pub name: Symbol,
@ -1465,18 +1402,8 @@ impl Atom for RegionVid {
}
}
#[derive(
Clone,
Copy,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
RustcEncodable,
RustcDecodable,
HashStable
)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
#[derive(HashStable)]
pub enum InferTy {
TyVar(TyVid),
IntVar(IntVid),
@ -1494,37 +1421,15 @@ rustc_index::newtype_index! {
pub struct BoundVar { .. }
}
#[derive(
Clone,
Copy,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
Debug,
RustcEncodable,
RustcDecodable,
HashStable
)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)]
#[derive(HashStable)]
pub struct BoundTy {
pub var: BoundVar,
pub kind: BoundTyKind,
}
#[derive(
Clone,
Copy,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
Debug,
RustcEncodable,
RustcDecodable,
HashStable
)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)]
#[derive(HashStable)]
pub enum BoundTyKind {
Anon,
Param(Symbol),
@ -2358,19 +2263,8 @@ impl<'tcx> TyS<'tcx> {
}
/// Typed constant value.
#[derive(
Copy,
Clone,
Debug,
Hash,
RustcEncodable,
RustcDecodable,
Eq,
PartialEq,
Ord,
PartialOrd,
HashStable
)]
#[derive(Copy, Clone, Debug, Hash, RustcEncodable, RustcDecodable, Eq, PartialEq, Ord, PartialOrd)]
#[derive(HashStable)]
pub struct Const<'tcx> {
pub ty: Ty<'tcx>,
@ -2499,19 +2393,8 @@ impl<'tcx> Const<'tcx> {
impl<'tcx> rustc_serialize::UseSpecializedDecodable for &'tcx Const<'tcx> {}
/// Represents a constant in Rust.
#[derive(
Copy,
Clone,
Debug,
Eq,
PartialEq,
PartialOrd,
Ord,
RustcEncodable,
RustcDecodable,
Hash,
HashStable
)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Hash)]
#[derive(HashStable)]
pub enum ConstKind<'tcx> {
/// A const generic parameter.
Param(ParamConst),
@ -2549,19 +2432,8 @@ impl<'tcx> ConstKind<'tcx> {
}
/// An inference variable for a const, for use in const generics.
#[derive(
Copy,
Clone,
Debug,
Eq,
PartialEq,
PartialOrd,
Ord,
RustcEncodable,
RustcDecodable,
Hash,
HashStable
)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Hash)]
#[derive(HashStable)]
pub enum InferConst<'tcx> {
/// Infer the value of the const.
Var(ConstVid<'tcx>),

View File

@ -684,19 +684,8 @@ pub enum PatKind {
MacCall(MacCall),
}
#[derive(
Clone,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
RustcEncodable,
RustcDecodable,
Debug,
Copy,
HashStable_Generic
)]
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable, Debug, Copy)]
#[derive(HashStable_Generic)]
pub enum Mutability {
Mut,
Not,
@ -1321,19 +1310,8 @@ pub enum CaptureBy {
/// The movability of a generator / closure literal:
/// whether a generator contains self-references, causing it to be `!Unpin`.
#[derive(
Clone,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
RustcEncodable,
RustcDecodable,
Debug,
Copy,
HashStable_Generic
)]
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable, Debug, Copy)]
#[derive(HashStable_Generic)]
pub enum Movability {
/// May contain self-references, `!Unpin`.
Static,
@ -1614,19 +1592,8 @@ pub struct FnSig {
pub decl: P<FnDecl>,
}
#[derive(
Clone,
Copy,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
HashStable_Generic,
RustcEncodable,
RustcDecodable,
Debug
)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable, Debug)]
#[derive(HashStable_Generic)]
pub enum FloatTy {
F32,
F64,
@ -1655,19 +1622,8 @@ impl FloatTy {
}
}
#[derive(
Clone,
Copy,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
HashStable_Generic,
RustcEncodable,
RustcDecodable,
Debug
)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable, Debug)]
#[derive(HashStable_Generic)]
pub enum IntTy {
Isize,
I8,
@ -1731,19 +1687,8 @@ impl IntTy {
}
}
#[derive(
Clone,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
HashStable_Generic,
RustcEncodable,
RustcDecodable,
Copy,
Debug
)]
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable, Copy, Debug)]
#[derive(HashStable_Generic)]
pub enum UintTy {
Usize,
U8,

View File

@ -120,17 +120,8 @@ pub fn find_unwind_attr(diagnostic: Option<&Handler>, attrs: &[Attribute]) -> Op
}
/// Represents the #[stable], #[unstable], #[rustc_deprecated] attributes.
#[derive(
RustcEncodable,
RustcDecodable,
Copy,
Clone,
Debug,
PartialEq,
Eq,
Hash,
HashStable_Generic
)]
#[derive(RustcEncodable, RustcDecodable, Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[derive(HashStable_Generic)]
pub struct Stability {
pub level: StabilityLevel,
pub feature: Symbol,
@ -138,17 +129,8 @@ pub struct Stability {
}
/// Represents the #[rustc_const_unstable] and #[rustc_const_stable] attributes.
#[derive(
RustcEncodable,
RustcDecodable,
Copy,
Clone,
Debug,
PartialEq,
Eq,
Hash,
HashStable_Generic
)]
#[derive(RustcEncodable, RustcDecodable, Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[derive(HashStable_Generic)]
pub struct ConstStability {
pub level: StabilityLevel,
pub feature: Symbol,
@ -159,18 +141,8 @@ pub struct ConstStability {
}
/// The available stability levels.
#[derive(
RustcEncodable,
RustcDecodable,
PartialEq,
PartialOrd,
Copy,
Clone,
Debug,
Eq,
Hash,
HashStable_Generic
)]
#[derive(RustcEncodable, RustcDecodable, PartialEq, PartialOrd, Copy, Clone, Debug, Eq, Hash)]
#[derive(HashStable_Generic)]
pub enum StabilityLevel {
// Reason for the current stability level and the relevant rust-lang issue
Unstable { reason: Option<Symbol>, issue: Option<NonZeroU32>, is_soft: bool },
@ -186,18 +158,8 @@ impl StabilityLevel {
}
}
#[derive(
RustcEncodable,
RustcDecodable,
PartialEq,
PartialOrd,
Copy,
Clone,
Debug,
Eq,
Hash,
HashStable_Generic
)]
#[derive(RustcEncodable, RustcDecodable, PartialEq, PartialOrd, Copy, Clone, Debug, Eq, Hash)]
#[derive(HashStable_Generic)]
pub struct RustcDeprecation {
pub since: Symbol,
pub reason: Symbol,

View File

@ -105,19 +105,8 @@ impl ::std::fmt::Debug for CrateNum {
}
}
#[derive(
Copy,
Clone,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
Debug,
RustcEncodable,
RustcDecodable,
HashStable_Generic
)]
#[derive(Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Debug, RustcEncodable, RustcDecodable)]
#[derive(HashStable_Generic)]
pub struct DefPathHash(pub Fingerprint);
impl Borrow<Fingerprint> for DefPathHash {

View File

@ -5,18 +5,8 @@ use std::str::FromStr;
use rustc_macros::HashStable_Generic;
/// The edition of the compiler (RFC 2052)
#[derive(
Clone,
Copy,
Hash,
PartialEq,
PartialOrd,
Debug,
RustcEncodable,
RustcDecodable,
Eq,
HashStable_Generic
)]
#[derive(Clone, Copy, Hash, PartialEq, PartialOrd, Debug, RustcEncodable, RustcDecodable, Eq)]
#[derive(HashStable_Generic)]
pub enum Edition {
// editions must be kept in order, oldest to newest
/// The 2015 edition

View File

@ -59,18 +59,8 @@ pub struct ExpnId(u32);
/// A property of a macro expansion that determines how identifiers
/// produced by that expansion are resolved.
#[derive(
Copy,
Clone,
PartialEq,
Eq,
PartialOrd,
Hash,
Debug,
RustcEncodable,
RustcDecodable,
HashStable_Generic
)]
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Hash, Debug, RustcEncodable, RustcDecodable)]
#[derive(HashStable_Generic)]
pub enum Transparency {
/// Identifier produced by a transparent expansion is always resolved at call-site.
/// Call-site spans in procedural macros, hygiene opt-out in `macro` should use this.
@ -747,17 +737,8 @@ impl ExpnKind {
}
/// The kind of macro invocation or definition.
#[derive(
Clone,
Copy,
PartialEq,
Eq,
RustcEncodable,
RustcDecodable,
Hash,
Debug,
HashStable_Generic
)]
#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
#[derive(HashStable_Generic)]
pub enum MacroKind {
/// A bang macro `foo!()`.
Bang,

View File

@ -72,18 +72,8 @@ impl Globals {
scoped_tls::scoped_thread_local!(pub static GLOBALS: Globals);
/// Differentiates between real files and common virtual files.
#[derive(
Debug,
Eq,
PartialEq,
Clone,
Ord,
PartialOrd,
Hash,
RustcDecodable,
RustcEncodable,
HashStable_Generic
)]
#[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Hash, RustcDecodable, RustcEncodable)]
#[derive(HashStable_Generic)]
pub enum FileName {
Real(PathBuf),
/// Call to `quote!`.

View File

@ -5,19 +5,8 @@ use rustc_macros::HashStable_Generic;
#[cfg(test)]
mod tests;
#[derive(
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
RustcEncodable,
RustcDecodable,
Clone,
Copy,
Debug,
HashStable_Generic
)]
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable, Clone, Copy, Debug)]
#[derive(HashStable_Generic)]
pub enum Abi {
// N.B., this ordering MUST match the AbiDatas array below.
// (This is ensured by the test indices_are_correct().)