Skip to content

Commit 2433371

Browse files
committed
gamer
1 parent 7bfb0ec commit 2433371

File tree

13 files changed

+101
-100
lines changed

13 files changed

+101
-100
lines changed

compiler/rustc_middle/src/mir/coverage.rs

+16-16
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::fmt::{self, Debug, Formatter};
44

55
use rustc_index::IndexVec;
6-
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
6+
use rustc_macros::{HashStable, NoopTypeTraversable, TyDecodable, TyEncodable};
77
use rustc_span::{Span, Symbol};
88

99
rustc_index::newtype_index! {
@@ -77,7 +77,7 @@ impl ConditionId {
7777
/// but the zero/counter/expression distinction is also useful for representing
7878
/// the value of code/gap mappings, and the true/false arms of branch mappings.
7979
#[derive(Copy, Clone, PartialEq, Eq)]
80-
#[derive(TyEncodable, TyDecodable, Hash, HashStable, TypeFoldable, TypeVisitable)]
80+
#[derive(TyEncodable, TyDecodable, Hash, HashStable)]
8181
pub enum CovTerm {
8282
Zero,
8383
Counter(CounterId),
@@ -94,7 +94,7 @@ impl Debug for CovTerm {
9494
}
9595
}
9696

97-
#[derive(Clone, PartialEq, TyEncodable, TyDecodable, Hash, HashStable, TypeFoldable, TypeVisitable)]
97+
#[derive(Clone, PartialEq, TyEncodable, TyDecodable, Hash, HashStable, NoopTypeTraversable)]
9898
pub enum CoverageKind {
9999
/// Marks a span that might otherwise not be represented in MIR, so that
100100
/// coverage instrumentation can associate it with its enclosing block/BCB.
@@ -155,8 +155,8 @@ impl Debug for CoverageKind {
155155
}
156156
}
157157

158-
#[derive(Clone, TyEncodable, TyDecodable, Hash, HashStable, PartialEq, Eq, PartialOrd, Ord)]
159-
#[derive(TypeFoldable, TypeVisitable)]
158+
#[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable)]
159+
#[derive(TyEncodable, TyDecodable, NoopTypeTraversable)]
160160
pub struct SourceRegion {
161161
pub file_name: Symbol,
162162
pub start_line: u32,
@@ -176,7 +176,7 @@ impl Debug for SourceRegion {
176176
}
177177

178178
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, HashStable)]
179-
#[derive(TyEncodable, TyDecodable, TypeFoldable, TypeVisitable)]
179+
#[derive(TyEncodable, TyDecodable, NoopTypeTraversable)]
180180
pub enum Op {
181181
Subtract,
182182
Add,
@@ -193,15 +193,15 @@ impl Op {
193193
}
194194

195195
#[derive(Clone, Debug)]
196-
#[derive(TyEncodable, TyDecodable, Hash, HashStable, TypeFoldable, TypeVisitable)]
196+
#[derive(TyEncodable, TyDecodable, Hash, HashStable, NoopTypeTraversable)]
197197
pub struct Expression {
198198
pub lhs: CovTerm,
199199
pub op: Op,
200200
pub rhs: CovTerm,
201201
}
202202

203203
#[derive(Clone, Debug)]
204-
#[derive(TyEncodable, TyDecodable, Hash, HashStable, TypeFoldable, TypeVisitable)]
204+
#[derive(TyEncodable, TyDecodable, Hash, HashStable, NoopTypeTraversable)]
205205
pub enum MappingKind {
206206
/// Associates a normal region of code with a counter/expression/zero.
207207
Code(CovTerm),
@@ -233,7 +233,7 @@ impl MappingKind {
233233
}
234234

235235
#[derive(Clone, Debug)]
236-
#[derive(TyEncodable, TyDecodable, Hash, HashStable, TypeFoldable, TypeVisitable)]
236+
#[derive(TyEncodable, TyDecodable, Hash, HashStable, NoopTypeTraversable)]
237237
pub struct Mapping {
238238
pub kind: MappingKind,
239239
pub source_region: SourceRegion,
@@ -243,7 +243,7 @@ pub struct Mapping {
243243
/// to be used in conjunction with the individual coverage statements injected
244244
/// into the function's basic blocks.
245245
#[derive(Clone, Debug)]
246-
#[derive(TyEncodable, TyDecodable, Hash, HashStable, TypeFoldable, TypeVisitable)]
246+
#[derive(TyEncodable, TyDecodable, Hash, HashStable, NoopTypeTraversable)]
247247
pub struct FunctionCoverageInfo {
248248
pub function_source_hash: u64,
249249
pub num_counters: usize,
@@ -262,7 +262,7 @@ pub struct FunctionCoverageInfo {
262262
/// ("Hi" indicates that this is "high-level" information collected at the
263263
/// THIR/MIR boundary, before the MIR-based coverage instrumentation pass.)
264264
#[derive(Clone, Debug)]
265-
#[derive(TyEncodable, TyDecodable, Hash, HashStable, TypeFoldable, TypeVisitable)]
265+
#[derive(TyEncodable, TyDecodable, Hash, HashStable, NoopTypeTraversable)]
266266
pub struct CoverageInfoHi {
267267
/// 1 more than the highest-numbered [`CoverageKind::BlockMarker`] that was
268268
/// injected into the MIR body. This makes it possible to allocate per-ID
@@ -276,23 +276,23 @@ pub struct CoverageInfoHi {
276276
}
277277

278278
#[derive(Clone, Debug)]
279-
#[derive(TyEncodable, TyDecodable, Hash, HashStable, TypeFoldable, TypeVisitable)]
279+
#[derive(TyEncodable, TyDecodable, Hash, HashStable, NoopTypeTraversable)]
280280
pub struct BranchSpan {
281281
pub span: Span,
282282
pub true_marker: BlockMarkerId,
283283
pub false_marker: BlockMarkerId,
284284
}
285285

286286
#[derive(Copy, Clone, Debug)]
287-
#[derive(TyEncodable, TyDecodable, Hash, HashStable, TypeFoldable, TypeVisitable)]
287+
#[derive(TyEncodable, TyDecodable, Hash, HashStable, NoopTypeTraversable)]
288288
pub struct ConditionInfo {
289289
pub condition_id: ConditionId,
290290
pub true_next_id: Option<ConditionId>,
291291
pub false_next_id: Option<ConditionId>,
292292
}
293293

294294
#[derive(Clone, Debug)]
295-
#[derive(TyEncodable, TyDecodable, Hash, HashStable, TypeFoldable, TypeVisitable)]
295+
#[derive(TyEncodable, TyDecodable, Hash, HashStable, NoopTypeTraversable)]
296296
pub struct MCDCBranchSpan {
297297
pub span: Span,
298298
pub condition_info: ConditionInfo,
@@ -301,14 +301,14 @@ pub struct MCDCBranchSpan {
301301
}
302302

303303
#[derive(Copy, Clone, Debug)]
304-
#[derive(TyEncodable, TyDecodable, Hash, HashStable, TypeFoldable, TypeVisitable)]
304+
#[derive(TyEncodable, TyDecodable, Hash, HashStable, NoopTypeTraversable)]
305305
pub struct DecisionInfo {
306306
pub bitmap_idx: u32,
307307
pub num_conditions: u16,
308308
}
309309

310310
#[derive(Clone, Debug)]
311-
#[derive(TyEncodable, TyDecodable, Hash, HashStable, TypeFoldable, TypeVisitable)]
311+
#[derive(TyEncodable, TyDecodable, Hash, HashStable, NoopTypeTraversable)]
312312
pub struct MCDCDecisionSpan {
313313
pub span: Span,
314314
pub end_markers: Vec<BlockMarkerId>,

compiler/rustc_middle/src/mir/mod.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ use rustc_hir::{
2222
};
2323
use rustc_index::bit_set::BitSet;
2424
use rustc_index::{Idx, IndexSlice, IndexVec};
25-
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
25+
use rustc_macros::{
26+
HashStable, NoopTypeTraversable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable,
27+
};
2628
use rustc_serialize::{Decodable, Encodable};
2729
use rustc_span::source_map::Spanned;
2830
use rustc_span::symbol::Symbol;
@@ -1548,7 +1550,7 @@ pub struct SourceScopeLocalData {
15481550
/// The first will lead to the constraint `w: &'1 str` (for some
15491551
/// inferred region `'1`). The second will lead to the constraint `w:
15501552
/// &'static str`.
1551-
#[derive(Clone, Debug, TyEncodable, TyDecodable, HashStable, TypeFoldable, TypeVisitable)]
1553+
#[derive(Clone, Debug, TyEncodable, TyDecodable, HashStable, NoopTypeTraversable)]
15521554
pub struct UserTypeProjections {
15531555
pub contents: Vec<(UserTypeProjection, Span)>,
15541556
}
@@ -1627,7 +1629,7 @@ impl<'tcx> UserTypeProjections {
16271629
/// `field[0]` (aka `.0`), indicating that the type of `s` is
16281630
/// determined by finding the type of the `.0` field from `T`.
16291631
#[derive(Clone, Debug, TyEncodable, TyDecodable, Hash, HashStable, PartialEq)]
1630-
#[derive(TypeFoldable, TypeVisitable)]
1632+
#[derive(NoopTypeTraversable)]
16311633
pub struct UserTypeProjection {
16321634
pub base: UserTypeAnnotationIndex,
16331635
pub projs: Vec<ProjectionKind>,

compiler/rustc_middle/src/mir/query.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ use rustc_errors::ErrorGuaranteed;
99
use rustc_hir::def_id::LocalDefId;
1010
use rustc_index::bit_set::BitMatrix;
1111
use rustc_index::{Idx, IndexVec};
12-
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
12+
use rustc_macros::{
13+
HashStable, NoopTypeTraversable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable,
14+
};
1315
use rustc_span::Span;
1416
use rustc_span::symbol::Symbol;
1517
use rustc_target::abi::{FieldIdx, VariantIdx};
@@ -276,7 +278,7 @@ pub enum ConstraintCategory<'tcx> {
276278
}
277279

278280
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
279-
#[derive(TyEncodable, TyDecodable, HashStable, TypeVisitable, TypeFoldable)]
281+
#[derive(TyEncodable, TyDecodable, HashStable, NoopTypeTraversable)]
280282
pub enum ReturnConstraint {
281283
Normal,
282284
ClosureUpvar(FieldIdx),

compiler/rustc_middle/src/mir/syntax.rs

+15-13
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ use rustc_data_structures::packed::Pu128;
88
use rustc_hir::CoroutineKind;
99
use rustc_hir::def_id::DefId;
1010
use rustc_index::IndexVec;
11-
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
11+
use rustc_macros::{
12+
HashStable, NoopTypeTraversable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable,
13+
};
1214
use rustc_span::Span;
1315
use rustc_span::def_id::LocalDefId;
1416
use rustc_span::source_map::Spanned;
@@ -581,8 +583,8 @@ pub struct CopyNonOverlapping<'tcx> {
581583

582584
/// Represents how a [`TerminatorKind::Call`] was constructed.
583585
/// Used only for diagnostics.
584-
#[derive(Clone, Copy, TyEncodable, TyDecodable, Debug, PartialEq, Hash, HashStable)]
585-
#[derive(TypeFoldable, TypeVisitable)]
586+
#[derive(Clone, Copy, Debug, PartialEq, Hash, HashStable)]
587+
#[derive(TyEncodable, TyDecodable, NoopTypeTraversable)]
586588
pub enum CallSource {
587589
/// This came from something such as `a > b` or `a + b`. In THIR, if `from_hir_call`
588590
/// is false then this is the desugaring.
@@ -605,8 +607,8 @@ impl CallSource {
605607
}
606608
}
607609

608-
#[derive(Clone, Copy, Debug, TyEncodable, TyDecodable, Hash, HashStable, PartialEq)]
609-
#[derive(TypeFoldable, TypeVisitable)]
610+
#[derive(Clone, Copy, Debug, Hash, HashStable, PartialEq)]
611+
#[derive(TyEncodable, TyDecodable, NoopTypeTraversable)]
610612
/// The macro that an inline assembly block was created by
611613
pub enum InlineAsmMacro {
612614
/// The `asm!` macro
@@ -951,8 +953,8 @@ pub struct SwitchTargets {
951953
}
952954

953955
/// Action to be taken when a stack unwind happens.
954-
#[derive(Copy, Clone, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
955-
#[derive(TypeFoldable, TypeVisitable)]
956+
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, HashStable)]
957+
#[derive(TyEncodable, TyDecodable, NoopTypeTraversable)]
956958
pub enum UnwindAction {
957959
/// No action is to be taken. Continue unwinding.
958960
///
@@ -970,8 +972,8 @@ pub enum UnwindAction {
970972
}
971973

972974
/// The reason we are terminating the process during unwinding.
973-
#[derive(Copy, Clone, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
974-
#[derive(TypeFoldable, TypeVisitable)]
975+
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, HashStable)]
976+
#[derive(TyEncodable, TyDecodable, NoopTypeTraversable)]
975977
pub enum UnwindTerminateReason {
976978
/// Unwinding is just not possible given the ABI of this function.
977979
Abi,
@@ -1501,8 +1503,8 @@ pub enum NullOp<'tcx> {
15011503
UbChecks,
15021504
}
15031505

1504-
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
1505-
#[derive(HashStable, TyEncodable, TyDecodable, TypeFoldable, TypeVisitable)]
1506+
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, HashStable)]
1507+
#[derive(TyEncodable, TyDecodable, NoopTypeTraversable)]
15061508
pub enum UnOp {
15071509
/// The `!` operator for logical inversion
15081510
Not,
@@ -1519,8 +1521,8 @@ pub enum UnOp {
15191521
PtrMetadata,
15201522
}
15211523

1522-
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
1523-
#[derive(TyEncodable, TyDecodable, HashStable, TypeFoldable, TypeVisitable)]
1524+
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, HashStable)]
1525+
#[derive(TyEncodable, TyDecodable, NoopTypeTraversable)]
15241526
pub enum BinOp {
15251527
/// The `+` operator (addition)
15261528
Add,

compiler/rustc_middle/src/traits/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ use rustc_hir as hir;
1717
use rustc_hir::HirId;
1818
use rustc_hir::def_id::DefId;
1919
use rustc_macros::{
20-
Decodable, Encodable, HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable,
20+
Decodable, Encodable, HashStable, NoopTypeTraversable, TyDecodable, TyEncodable, TypeFoldable,
21+
TypeVisitable,
2122
};
2223
use rustc_span::def_id::{CRATE_DEF_ID, LocalDefId};
2324
use rustc_span::symbol::Symbol;
@@ -422,7 +423,7 @@ crate::TrivialTypeTraversalAndLiftImpls! {
422423
/// we can walk in order to obtain precise spans for any
423424
/// 'nested' types (e.g. `Foo` in `Option<Foo>`).
424425
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, HashStable, Encodable, Decodable)]
425-
#[derive(TypeVisitable, TypeFoldable)]
426+
#[derive(NoopTypeTraversable)]
426427
pub enum WellFormedLoc {
427428
/// Use the type of the provided definition.
428429
Ty(LocalDefId),

compiler/rustc_middle/src/ty/abstract_const.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
//! A subset of a mir body used for const evaluability checking.
22
33
use rustc_errors::ErrorGuaranteed;
4-
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeVisitable};
4+
use rustc_macros::{HashStable, NoopTypeTraversable, TyDecodable, TyEncodable};
55

66
use crate::ty::{
77
self, Const, EarlyBinder, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable,
88
TypeVisitableExt,
99
};
1010

1111
#[derive(Hash, Debug, Clone, Copy, Ord, PartialOrd, PartialEq, Eq)]
12-
#[derive(TyDecodable, TyEncodable, HashStable, TypeVisitable, TypeFoldable)]
12+
#[derive(TyDecodable, TyEncodable, HashStable, NoopTypeTraversable)]
1313
pub enum CastKind {
1414
/// thir::ExprKind::As
1515
As,

compiler/rustc_middle/src/ty/closure.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ use rustc_data_structures::fx::FxIndexMap;
55
use rustc_hir as hir;
66
use rustc_hir::HirId;
77
use rustc_hir::def_id::LocalDefId;
8-
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
8+
use rustc_macros::{
9+
HashStable, NoopTypeTraversable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable,
10+
};
911
use rustc_span::def_id::LocalDefIdMap;
1012
use rustc_span::symbol::Ident;
1113
use rustc_span::{Span, Symbol};
@@ -23,7 +25,7 @@ use crate::{mir, ty};
2325
pub const CAPTURE_STRUCT_LOCAL: mir::Local = mir::Local::from_u32(1);
2426

2527
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable)]
26-
#[derive(TypeFoldable, TypeVisitable)]
28+
#[derive(NoopTypeTraversable)]
2729
pub struct UpvarPath {
2830
pub hir_id: HirId,
2931
}
@@ -32,7 +34,7 @@ pub struct UpvarPath {
3234
/// the original var ID (that is, the root variable that is referenced
3335
/// by the upvar) and the ID of the closure expression.
3436
#[derive(Clone, Copy, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable)]
35-
#[derive(TypeFoldable, TypeVisitable)]
37+
#[derive(NoopTypeTraversable)]
3638
pub struct UpvarId {
3739
pub var_path: UpvarPath,
3840
pub closure_expr_id: LocalDefId,
@@ -47,7 +49,7 @@ impl UpvarId {
4749
/// Information describing the capture of an upvar. This is computed
4850
/// during `typeck`, specifically by `regionck`.
4951
#[derive(Eq, PartialEq, Clone, Debug, Copy, TyEncodable, TyDecodable, HashStable, Hash)]
50-
#[derive(TypeFoldable, TypeVisitable)]
52+
#[derive(NoopTypeTraversable)]
5153
pub enum UpvarCapture {
5254
/// Upvar is captured by value. This is always true when the
5355
/// closure is labeled `move`, but can also be true in other cases
@@ -252,7 +254,7 @@ pub fn is_ancestor_or_same_capture(
252254
/// for a particular capture as well as identifying the part of the source code
253255
/// that triggered this capture to occur.
254256
#[derive(Eq, PartialEq, Clone, Debug, Copy, TyEncodable, TyDecodable, HashStable, Hash)]
255-
#[derive(TypeFoldable, TypeVisitable)]
257+
#[derive(NoopTypeTraversable)]
256258
pub struct CaptureInfo {
257259
/// Expr Id pointing to use that resulted in selecting the current capture kind
258260
///

compiler/rustc_middle/src/ty/consts/kind.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
use std::assert_matches::assert_matches;
22

3-
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable, extension};
3+
use rustc_macros::{
4+
HashStable, NoopTypeTraversable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable,
5+
extension,
6+
};
47

58
use super::Const;
69
use crate::mir;
@@ -42,7 +45,7 @@ impl<'tcx> ty::UnevaluatedConst<'tcx> {
4245
}
4346

4447
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
45-
#[derive(HashStable, TyEncodable, TyDecodable, TypeVisitable, TypeFoldable)]
48+
#[derive(HashStable, TyEncodable, TyDecodable, NoopTypeTraversable)]
4649
pub enum ExprKind {
4750
Binop(mir::BinOp),
4851
UnOp(mir::UnOp),

compiler/rustc_middle/src/ty/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ pub enum ImplSubject<'tcx> {
274274
}
275275

276276
#[derive(Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable, Debug)]
277-
#[derive(TypeFoldable, TypeVisitable)]
278277
pub enum Asyncness {
279278
Yes,
280279
No,

compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use rustc_type_ir::relate::Relate;
1111
use rustc_type_ir::relate::solver_relating::RelateExt;
1212
use rustc_type_ir::visit::{TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor};
1313
use rustc_type_ir::{self as ty, CanonicalVarValues, InferCtxtLike, Interner};
14-
use rustc_type_ir_macros::{Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic};
1514
use tracing::{instrument, trace};
1615

1716
use crate::coherence;
@@ -91,7 +90,6 @@ where
9190
}
9291

9392
#[derive_where(Clone, Debug, Default; I: Interner)]
94-
#[derive(TypeVisitable_Generic, TypeFoldable_Generic, Lift_Generic)]
9593
#[cfg_attr(feature = "nightly", derive(TyDecodable, TyEncodable, HashStable_NoContext))]
9694
struct NestedGoals<I: Interner> {
9795
/// These normalizes-to goals are treated specially during the evaluation

0 commit comments

Comments
 (0)