Skip to content

Commit 5b29348

Browse files
authored
Rollup merge of #70318 - anyska:multiple-derives, r=Dylan-DPC
Split long derive lists into two derive attributes.
2 parents 176e2eb + fcb4e77 commit 5b29348

File tree

16 files changed

+78
-484
lines changed

16 files changed

+78
-484
lines changed

src/librustc/dep_graph/dep_node.rs

+2-13
Original file line numberDiff line numberDiff line change
@@ -489,19 +489,8 @@ impl<'tcx> DepNodeParams<'tcx> for HirId {
489489
/// some independent path or string that persists between runs without
490490
/// the need to be mapped or unmapped. (This ensures we can serialize
491491
/// them even in the absence of a tcx.)
492-
#[derive(
493-
Clone,
494-
Copy,
495-
Debug,
496-
PartialEq,
497-
Eq,
498-
PartialOrd,
499-
Ord,
500-
Hash,
501-
RustcEncodable,
502-
RustcDecodable,
503-
HashStable
504-
)]
492+
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
493+
#[derive(HashStable)]
505494
pub struct WorkProductId {
506495
hash: Fingerprint,
507496
}

src/librustc/middle/cstore.rs

+2-12
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,8 @@ impl CrateSource {
4040
}
4141
}
4242

43-
#[derive(
44-
RustcEncodable,
45-
RustcDecodable,
46-
Copy,
47-
Clone,
48-
Ord,
49-
PartialOrd,
50-
Eq,
51-
PartialEq,
52-
Debug,
53-
HashStable
54-
)]
43+
#[derive(RustcEncodable, RustcDecodable, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Debug)]
44+
#[derive(HashStable)]
5545
pub enum DepKind {
5646
/// A dependency that is only used for its macros.
5747
MacrosOnly,

src/librustc/middle/region.rs

+4-25
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,8 @@ use std::fmt;
8080
// placate the same deriving in `ty::FreeRegion`, but we may want to
8181
// actually attach a more meaningful ordering to scopes than the one
8282
// generated via deriving here.
83-
#[derive(
84-
Clone,
85-
PartialEq,
86-
PartialOrd,
87-
Eq,
88-
Ord,
89-
Hash,
90-
Copy,
91-
RustcEncodable,
92-
RustcDecodable,
93-
HashStable
94-
)]
83+
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, Copy, RustcEncodable, RustcDecodable)]
84+
#[derive(HashStable)]
9585
pub struct Scope {
9686
pub id: hir::ItemLocalId,
9787
pub data: ScopeData,
@@ -114,19 +104,8 @@ impl fmt::Debug for Scope {
114104
}
115105
}
116106

117-
#[derive(
118-
Clone,
119-
PartialEq,
120-
PartialOrd,
121-
Eq,
122-
Ord,
123-
Hash,
124-
Debug,
125-
Copy,
126-
RustcEncodable,
127-
RustcDecodable,
128-
HashStable
129-
)]
107+
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, Debug, Copy, RustcEncodable, RustcDecodable)]
108+
#[derive(HashStable)]
130109
pub enum ScopeData {
131110
Node,
132111

src/librustc/mir/interpret/allocation.rs

+4-24
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,8 @@ use std::ops::{Deref, DerefMut, Range};
1515

1616
// NOTE: When adding new fields, make sure to adjust the `Snapshot` impl in
1717
// `src/librustc_mir/interpret/snapshot.rs`.
18-
#[derive(
19-
Clone,
20-
Debug,
21-
Eq,
22-
PartialEq,
23-
PartialOrd,
24-
Ord,
25-
Hash,
26-
RustcEncodable,
27-
RustcDecodable,
28-
HashStable
29-
)]
18+
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
19+
#[derive(HashStable)]
3020
pub struct Allocation<Tag = (), Extra = ()> {
3121
/// The actual bytes of the allocation.
3222
/// Note that the bytes of a pointer represent the offset of the pointer.
@@ -759,18 +749,8 @@ type Block = u64;
759749

760750
/// A bitmask where each bit refers to the byte with the same index. If the bit is `true`, the byte
761751
/// is defined. If it is `false` the byte is undefined.
762-
#[derive(
763-
Clone,
764-
Debug,
765-
Eq,
766-
PartialEq,
767-
PartialOrd,
768-
Ord,
769-
Hash,
770-
RustcEncodable,
771-
RustcDecodable,
772-
HashStable
773-
)]
752+
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
753+
#[derive(HashStable)]
774754
pub struct UndefMask {
775755
blocks: Vec<Block>,
776756
len: Size,

src/librustc/mir/interpret/pointer.rs

+2-12
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,8 @@ impl<T: layout::HasDataLayout> PointerArithmetic for T {}
111111
///
112112
/// `Pointer` is also generic over the `Tag` associated with each pointer,
113113
/// which is used to do provenance tracking during execution.
114-
#[derive(
115-
Copy,
116-
Clone,
117-
Eq,
118-
PartialEq,
119-
Ord,
120-
PartialOrd,
121-
RustcEncodable,
122-
RustcDecodable,
123-
Hash,
124-
HashStable
125-
)]
114+
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, RustcEncodable, RustcDecodable, Hash)]
115+
#[derive(HashStable)]
126116
pub struct Pointer<Tag = (), Id = AllocId> {
127117
pub alloc_id: Id,
128118
pub offset: Size,

src/librustc/mir/interpret/value.rs

+4-25
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,8 @@ pub struct RawConst<'tcx> {
2323

2424
/// Represents a constant value in Rust. `Scalar` and `Slice` are optimizations for
2525
/// array length computations, enum discriminants and the pattern matching logic.
26-
#[derive(
27-
Copy,
28-
Clone,
29-
Debug,
30-
Eq,
31-
PartialEq,
32-
PartialOrd,
33-
Ord,
34-
RustcEncodable,
35-
RustcDecodable,
36-
Hash,
37-
HashStable
38-
)]
26+
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Hash)]
27+
#[derive(HashStable)]
3928
pub enum ConstValue<'tcx> {
4029
/// Used only for types with `layout::abi::Scalar` ABI and ZSTs.
4130
///
@@ -98,18 +87,8 @@ impl<'tcx> ConstValue<'tcx> {
9887
/// `memory::Allocation`. It is in many ways like a small chunk of a `Allocation`, up to 8 bytes in
9988
/// size. Like a range of bytes in an `Allocation`, a `Scalar` can either represent the raw bytes
10089
/// of a simple value or a pointer into another `Allocation`
101-
#[derive(
102-
Clone,
103-
Copy,
104-
Eq,
105-
PartialEq,
106-
Ord,
107-
PartialOrd,
108-
RustcEncodable,
109-
RustcDecodable,
110-
Hash,
111-
HashStable
112-
)]
90+
#[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, RustcEncodable, RustcDecodable, Hash)]
91+
#[derive(HashStable)]
11392
pub enum Scalar<Tag = (), Id = AllocId> {
11493
/// The raw bytes of a simple value.
11594
Raw {

src/librustc/mir/mod.rs

+4-24
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,8 @@ impl<'tcx> HasLocalDecls<'tcx> for Body<'tcx> {
6969
/// The various "big phases" that MIR goes through.
7070
///
7171
/// Warning: ordering of variants is significant.
72-
#[derive(
73-
Copy,
74-
Clone,
75-
RustcEncodable,
76-
RustcDecodable,
77-
HashStable,
78-
Debug,
79-
PartialEq,
80-
Eq,
81-
PartialOrd,
82-
Ord
83-
)]
72+
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug, PartialEq, Eq, PartialOrd, Ord)]
73+
#[derive(HashStable)]
8474
pub enum MirPhase {
8575
Build = 0,
8676
Const = 1,
@@ -439,18 +429,8 @@ pub struct SourceInfo {
439429
///////////////////////////////////////////////////////////////////////////
440430
// Borrow kinds
441431

442-
#[derive(
443-
Copy,
444-
Clone,
445-
Debug,
446-
PartialEq,
447-
Eq,
448-
PartialOrd,
449-
Ord,
450-
RustcEncodable,
451-
RustcDecodable,
452-
HashStable
453-
)]
432+
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, RustcEncodable, RustcDecodable)]
433+
#[derive(HashStable)]
454434
pub enum BorrowKind {
455435
/// Data must be immutable and is aliasable.
456436
Shared,

src/librustc/ty/mod.rs

+2-13
Original file line numberDiff line numberDiff line change
@@ -2642,19 +2642,8 @@ impl<'tcx> FieldDef {
26422642
///
26432643
/// You can get the environment type of a closure using
26442644
/// `tcx.closure_env_ty()`.
2645-
#[derive(
2646-
Clone,
2647-
Copy,
2648-
PartialOrd,
2649-
Ord,
2650-
PartialEq,
2651-
Eq,
2652-
Hash,
2653-
Debug,
2654-
RustcEncodable,
2655-
RustcDecodable,
2656-
HashStable
2657-
)]
2645+
#[derive(Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)]
2646+
#[derive(HashStable)]
26582647
pub enum ClosureKind {
26592648
// Warning: Ordering is significant here! The ordering is chosen
26602649
// because the trait Fn is a subtrait of FnMut and so in turn, and

0 commit comments

Comments
 (0)