Skip to content

Commit

Permalink
Rollup merge of #70318 - anyska:multiple-derives, r=Dylan-DPC
Browse files Browse the repository at this point in the history
Split long derive lists into two derive attributes.
  • Loading branch information
Centril committed Mar 23, 2020
2 parents 176e2eb + fcb4e77 commit 5b29348
Show file tree
Hide file tree
Showing 16 changed files with 78 additions and 484 deletions.
15 changes: 2 additions & 13 deletions src/librustc/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
14 changes: 2 additions & 12 deletions src/librustc/middle/cstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
29 changes: 4 additions & 25 deletions src/librustc/middle/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,

Expand Down
28 changes: 4 additions & 24 deletions src/librustc/mir/interpret/allocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down
14 changes: 2 additions & 12 deletions src/librustc/mir/interpret/pointer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
29 changes: 4 additions & 25 deletions src/librustc/mir/interpret/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down Expand Up @@ -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 {
Expand Down
28 changes: 4 additions & 24 deletions src/librustc/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
15 changes: 2 additions & 13 deletions src/librustc/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 5b29348

Please sign in to comment.