Skip to content

Commit 80c13ce

Browse files
committed
fix review comments
1 parent f7fe970 commit 80c13ce

File tree

6 files changed

+51
-49
lines changed

6 files changed

+51
-49
lines changed

src/librustc_incremental/persist/dirty_clean.rs

+17-18
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@
3939
//! previous revision to compare things to.
4040
//!
4141
42-
#![allow(dead_code)]
43-
4442
use std::collections::HashSet;
4543
use std::iter::FromIterator;
4644
use std::vec::Vec;
@@ -141,14 +139,14 @@ const LABELS_CONST: &[&[&str]] = &[
141139
];
142140

143141
/// Constant/Typedef in an impl
144-
const LABELS_CONST_ASSOCIATED: &[&[&str]] = &[
142+
const LABELS_CONST_IN_IMPL: &[&[&str]] = &[
145143
BASE_HIR,
146144
BASE_CONST,
147145
EXTRA_ASSOCIATED,
148146
];
149147

150148
/// Trait-Const/Typedef DepNodes
151-
const LABELS_CONST_TRAIT: &[&[&str]] = &[
149+
const LABELS_CONST_IN_TRAIT: &[&[&str]] = &[
152150
BASE_HIR,
153151
BASE_CONST,
154152
EXTRA_ASSOCIATED,
@@ -163,15 +161,15 @@ const LABELS_FN: &[&[&str]] = &[
163161
];
164162

165163
/// Method DepNodes
166-
const LABELS_FN_ASSOCIATED: &[&[&str]] = &[
164+
const LABELS_FN_IN_IMPL: &[&[&str]] = &[
167165
BASE_HIR,
168166
BASE_MIR,
169167
BASE_FN,
170168
EXTRA_ASSOCIATED,
171169
];
172170

173171
/// Trait-Method DepNodes
174-
const LABELS_FN_TRAIT: &[&[&str]] = &[
172+
const LABELS_FN_IN_TRAIT: &[&[&str]] = &[
175173
BASE_HIR,
176174
BASE_MIR,
177175
BASE_FN,
@@ -190,13 +188,14 @@ const LABELS_IMPL: &[&[&str]] = &[
190188
BASE_IMPL,
191189
];
192190

193-
/// Struct DepNodes
194-
const LABELS_STRUCT: &[&[&str]] = &[
191+
/// Abstract Data Type (Struct, Enum, Unions) DepNodes
192+
const LABELS_ADT: &[&[&str]] = &[
195193
BASE_HIR,
196194
BASE_STRUCT,
197195
];
198196

199197
/// Trait Definition DepNodes
198+
#[allow(dead_code)]
200199
const LABELS_TRAIT: &[&[&str]] = &[
201200
BASE_HIR,
202201
BASE_TRAIT_DEF,
@@ -382,16 +381,16 @@ impl<'a, 'tcx> DirtyCleanVisitor<'a, 'tcx> {
382381
HirItem::ItemGlobalAsm(..) => ("ItemGlobalAsm", LABELS_HIR_ONLY),
383382

384383
// A type alias, e.g. `type Foo = Bar<u8>`
385-
HirItem::ItemTy(..) => ("ItemTy", LABELS_CONST),
384+
HirItem::ItemTy(..) => ("ItemTy", LABELS_HIR_ONLY),
386385

387386
// An enum definition, e.g. `enum Foo<A, B> {C<A>, D<B>}`
388-
HirItem::ItemEnum(..) => ("ItemEnum", LABELS_STRUCT),
387+
HirItem::ItemEnum(..) => ("ItemEnum", LABELS_ADT),
389388

390389
// A struct definition, e.g. `struct Foo<A> {x: A}`
391-
HirItem::ItemStruct(..) => ("ItemStruct", LABELS_STRUCT),
390+
HirItem::ItemStruct(..) => ("ItemStruct", LABELS_ADT),
392391

393392
// A union definition, e.g. `union Foo<A, B> {x: A, y: B}`
394-
HirItem::ItemUnion(..) => ("ItemUnion", LABELS_STRUCT),
393+
HirItem::ItemUnion(..) => ("ItemUnion", LABELS_ADT),
395394

396395
// Represents a Trait Declaration
397396
// FIXME(michaelwoerister): trait declaration is buggy because sometimes some of
@@ -426,16 +425,16 @@ impl<'a, 'tcx> DirtyCleanVisitor<'a, 'tcx> {
426425
},
427426
HirNode::NodeTraitItem(item) => {
428427
match item.node {
429-
TraitItemKind::Method(..) => ("NodeTraitItem", LABELS_FN_TRAIT),
430-
TraitItemKind::Const(..) => ("NodeTraitConst", LABELS_CONST_TRAIT),
431-
TraitItemKind::Type(..) => ("NodeTraitType", LABELS_CONST_TRAIT),
428+
TraitItemKind::Method(..) => ("NodeTraitItem", LABELS_FN_IN_TRAIT),
429+
TraitItemKind::Const(..) => ("NodeTraitConst", LABELS_CONST_IN_TRAIT),
430+
TraitItemKind::Type(..) => ("NodeTraitType", LABELS_CONST_IN_TRAIT),
432431
}
433432
},
434433
HirNode::NodeImplItem(item) => {
435434
match item.node {
436-
ImplItemKind::Method(..) => ("NodeImplItem", LABELS_FN_ASSOCIATED),
437-
ImplItemKind::Const(..) => ("NodeImplConst", LABELS_CONST_ASSOCIATED),
438-
ImplItemKind::Type(..) => ("NodeImplType", LABELS_CONST_ASSOCIATED),
435+
ImplItemKind::Method(..) => ("NodeImplItem", LABELS_FN_IN_IMPL),
436+
ImplItemKind::Const(..) => ("NodeImplConst", LABELS_CONST_IN_IMPL),
437+
ImplItemKind::Type(..) => ("NodeImplType", LABELS_CONST_IN_IMPL),
439438
}
440439
},
441440
_ => self.tcx.sess.span_fatal(

src/test/incremental/hashes/call_expressions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,13 @@ pub fn change_to_ufcs() {
171171
s.method1('x', true);
172172
}
173173

174-
// FIXME(vitiral): why would this change anything, doesn't the Mir/Hir expand this
175-
// sort of stuff?
176174
#[cfg(not(cfail1))]
177175
#[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized,TypeckTables")]
178176
#[rustc_clean(cfg="cfail3")]
179177
#[rustc_metadata_clean(cfg="cfail2")]
180178
#[rustc_metadata_clean(cfg="cfail3")]
179+
// One might think this would be expanded in the HirBody/Mir, but it actually
180+
// results in slightly different Hir/Mir.
181181
pub fn change_to_ufcs() {
182182
let s = Struct;
183183
Struct::method1(&s, 'x', true);

src/test/incremental/hashes/enum_constructors.rs

+16-5
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ fn change_field_order_struct_like() -> Enum {
7474
#[rustc_clean(cfg="cfail3")]
7575
#[rustc_metadata_clean(cfg="cfail2")]
7676
#[rustc_metadata_clean(cfg="cfail3")]
77+
// FIXME(michaelwoerister):Interesting. I would have thought that that changes the MIR. And it
78+
// would if it were not all constants
7779
fn change_field_order_struct_like() -> Enum {
7880
Enum::Struct {
7981
y: 4,
@@ -156,7 +158,8 @@ mod change_constructor_path_indirectly_struct_like {
156158

157159
#[rustc_clean(
158160
cfg="cfail2",
159-
except="FnSignature,Hir,HirBody,MirOptimized,MirValidated,TypeckTables"
161+
except="FnSignature,Hir,HirBody,MirOptimized,MirValidated,\
162+
TypeckTables"
160163
)]
161164
#[rustc_clean(cfg="cfail3")]
162165
#[rustc_metadata_dirty(cfg="cfail2")]
@@ -217,7 +220,10 @@ fn change_constructor_path_tuple_like() {
217220
}
218221

219222
#[cfg(not(cfail1))]
220-
#[rustc_clean(cfg="cfail2", except="HirBody,MirOptimized,MirValidated,TypeckTables")]
223+
#[rustc_clean(
224+
cfg="cfail2",
225+
except="HirBody,MirOptimized,MirValidated,TypeckTables"
226+
)]
221227
#[rustc_clean(cfg="cfail3")]
222228
#[rustc_metadata_clean(cfg="cfail2")]
223229
#[rustc_metadata_clean(cfg="cfail3")]
@@ -234,7 +240,10 @@ fn change_constructor_variant_tuple_like() {
234240
}
235241

236242
#[cfg(not(cfail1))]
237-
#[rustc_clean(cfg="cfail2", except="HirBody,MirOptimized,MirValidated,TypeckTables")]
243+
#[rustc_clean(
244+
cfg="cfail2",
245+
except="HirBody,MirOptimized,MirValidated,TypeckTables"
246+
)]
238247
#[rustc_clean(cfg="cfail3")]
239248
#[rustc_metadata_clean(cfg="cfail2")]
240249
#[rustc_metadata_clean(cfg="cfail3")]
@@ -252,7 +261,8 @@ mod change_constructor_path_indirectly_tuple_like {
252261

253262
#[rustc_clean(
254263
cfg="cfail2",
255-
except="FnSignature,Hir,HirBody,MirOptimized,MirValidated,TypeckTables"
264+
except="FnSignature,Hir,HirBody,MirOptimized,MirValidated,\
265+
TypeckTables"
256266
)]
257267
#[rustc_clean(cfg="cfail3")]
258268
#[rustc_metadata_dirty(cfg="cfail2")]
@@ -335,7 +345,8 @@ mod change_constructor_path_indirectly_c_like {
335345

336346
#[rustc_clean(
337347
cfg="cfail2",
338-
except="FnSignature,Hir,HirBody,MirOptimized,MirValidated,TypeckTables"
348+
except="FnSignature,Hir,HirBody,MirOptimized,MirValidated,\
349+
TypeckTables"
339350
)]
340351
#[rustc_clean(cfg="cfail3")]
341352
#[rustc_metadata_dirty(cfg="cfail2")]

src/test/incremental/hashes/enum_defs.rs

+4-14
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,6 @@ enum EnumChangeNameOfTypeParameter<S> {
444444
#[rustc_clean(cfg="cfail3")]
445445
#[rustc_metadata_dirty(cfg="cfail2")]
446446
#[rustc_metadata_clean(cfg="cfail3")]
447-
#[repr(C)]
448447
enum EnumChangeNameOfTypeParameter<T> {
449448
Variant1(T),
450449
}
@@ -463,7 +462,6 @@ enum EnumAddTypeParameter<S> {
463462
#[rustc_clean(cfg="cfail3")]
464463
#[rustc_metadata_dirty(cfg="cfail2")]
465464
#[rustc_metadata_clean(cfg="cfail3")]
466-
#[repr(C)]
467465
enum EnumAddTypeParameter<S, T> {
468466
Variant1(S),
469467
Variant2(T),
@@ -482,7 +480,6 @@ enum EnumChangeNameOfLifetimeParameter<'a> {
482480
#[rustc_clean(cfg="cfail3")]
483481
#[rustc_metadata_dirty(cfg="cfail2")]
484482
#[rustc_metadata_clean(cfg="cfail3")]
485-
#[repr(C)]
486483
enum EnumChangeNameOfLifetimeParameter<'b> {
487484
Variant1(&'b u32),
488485
}
@@ -501,7 +498,6 @@ enum EnumAddLifetimeParameter<'a> {
501498
#[rustc_clean(cfg="cfail3")]
502499
#[rustc_metadata_dirty(cfg="cfail2")]
503500
#[rustc_metadata_clean(cfg="cfail3")]
504-
#[repr(C)]
505501
enum EnumAddLifetimeParameter<'a, 'b> {
506502
Variant1(&'a u32),
507503
Variant2(&'b u32),
@@ -517,11 +513,10 @@ enum EnumAddLifetimeParameterBound<'a, 'b> {
517513
}
518514

519515
#[cfg(not(cfail1))]
520-
#[rustc_dirty(cfg="cfail2", except="GenericsOfItem")]
516+
#[rustc_dirty(cfg="cfail2", except="GenericsOfItem,TypeOfItem")]
521517
#[rustc_clean(cfg="cfail3")]
522518
#[rustc_metadata_dirty(cfg="cfail2")]
523519
#[rustc_metadata_clean(cfg="cfail3")]
524-
#[repr(C)]
525520
enum EnumAddLifetimeParameterBound<'a, 'b: 'a> {
526521
Variant1(&'a u32),
527522
Variant2(&'b u32),
@@ -535,11 +530,10 @@ enum EnumAddLifetimeBoundToParameter<'a, T> {
535530
}
536531

537532
#[cfg(not(cfail1))]
538-
#[rustc_dirty(cfg="cfail2")]
533+
#[rustc_dirty(cfg="cfail2", except="TypeOfItem")]
539534
#[rustc_clean(cfg="cfail3")]
540535
#[rustc_metadata_dirty(cfg="cfail2")]
541536
#[rustc_metadata_clean(cfg="cfail3")]
542-
#[repr(C)]
543537
enum EnumAddLifetimeBoundToParameter<'a, T: 'a> {
544538
Variant1(T),
545539
Variant2(&'a u32),
@@ -558,7 +552,6 @@ enum EnumAddTraitBound<S> {
558552
#[rustc_clean(cfg="cfail3")]
559553
#[rustc_metadata_dirty(cfg="cfail2")]
560554
#[rustc_metadata_clean(cfg="cfail3")]
561-
#[repr(C)]
562555
enum EnumAddTraitBound<T: Sync> {
563556
Variant1(T),
564557
}
@@ -573,11 +566,10 @@ enum EnumAddLifetimeParameterBoundWhere<'a, 'b> {
573566
}
574567

575568
#[cfg(not(cfail1))]
576-
#[rustc_dirty(cfg="cfail2", except="GenericsOfItem")]
569+
#[rustc_dirty(cfg="cfail2", except="GenericsOfItem,TypeOfItem")]
577570
#[rustc_clean(cfg="cfail3")]
578571
#[rustc_metadata_dirty(cfg="cfail2")]
579572
#[rustc_metadata_clean(cfg="cfail3")]
580-
#[repr(C)]
581573
enum EnumAddLifetimeParameterBoundWhere<'a, 'b> where 'b: 'a {
582574
Variant1(&'a u32),
583575
Variant2(&'b u32),
@@ -593,11 +585,10 @@ enum EnumAddLifetimeBoundToParameterWhere<'a, T> {
593585
}
594586

595587
#[cfg(not(cfail1))]
596-
#[rustc_dirty(cfg="cfail2")]
588+
#[rustc_dirty(cfg="cfail2", except="TypeOfItem")]
597589
#[rustc_clean(cfg="cfail3")]
598590
#[rustc_metadata_dirty(cfg="cfail2")]
599591
#[rustc_metadata_clean(cfg="cfail3")]
600-
#[repr(C)]
601592
enum EnumAddLifetimeBoundToParameterWhere<'a, T> where T: 'a {
602593
Variant1(T),
603594
Variant2(&'a u32),
@@ -616,7 +607,6 @@ enum EnumAddTraitBoundWhere<S> {
616607
#[rustc_clean(cfg="cfail3")]
617608
#[rustc_metadata_dirty(cfg="cfail2")]
618609
#[rustc_metadata_clean(cfg="cfail3")]
619-
#[repr(C)]
620610
enum EnumAddTraitBoundWhere<T> where T: Sync {
621611
Variant1(T),
622612
}

src/test/incremental/hashes/inherent_impls.rs

+2
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,8 @@ impl Foo {
370370
#[rustc_metadata_clean(cfg="cfail2")]
371371
#[rustc_metadata_clean(cfg="cfail3")]
372372
impl Foo {
373+
// FIXME(michaelwoerister): This is curious but an unused lifetime parameter doesn't seem to
374+
// show up in any of the derived data structures.
373375
#[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
374376
#[rustc_clean(cfg="cfail3")]
375377
#[rustc_metadata_clean(cfg="cfail2")]

src/test/incremental/hashes/type_defs.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
type ChangePrimitiveType = i32;
3636

3737
#[cfg(not(cfail1))]
38-
#[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")]
38+
#[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
3939
#[rustc_clean(cfg="cfail3")]
4040
#[rustc_metadata_clean(cfg="cfail3")]
4141
type ChangePrimitiveType = i64;
@@ -47,7 +47,7 @@ type ChangePrimitiveType = i64;
4747
type ChangeMutability = &'static i32;
4848

4949
#[cfg(not(cfail1))]
50-
#[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")]
50+
#[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
5151
#[rustc_clean(cfg="cfail3")]
5252
#[rustc_metadata_clean(cfg="cfail3")]
5353
type ChangeMutability = &'static mut i32;
@@ -59,7 +59,7 @@ type ChangeMutability = &'static mut i32;
5959
type ChangeLifetime<'a> = (&'static i32, &'a i32);
6060

6161
#[cfg(not(cfail1))]
62-
#[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")]
62+
#[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
6363
#[rustc_clean(cfg="cfail3")]
6464
#[rustc_metadata_clean(cfg="cfail3")]
6565
type ChangeLifetime<'a> = (&'a i32, &'a i32);
@@ -74,7 +74,7 @@ struct Struct2;
7474
type ChangeTypeStruct = Struct1;
7575

7676
#[cfg(not(cfail1))]
77-
#[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")]
77+
#[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
7878
#[rustc_clean(cfg="cfail3")]
7979
#[rustc_metadata_clean(cfg="cfail3")]
8080
type ChangeTypeStruct = Struct2;
@@ -86,7 +86,7 @@ type ChangeTypeStruct = Struct2;
8686
type ChangeTypeTuple = (u32, u64);
8787

8888
#[cfg(not(cfail1))]
89-
#[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")]
89+
#[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
9090
#[rustc_clean(cfg="cfail3")]
9191
#[rustc_metadata_clean(cfg="cfail3")]
9292
type ChangeTypeTuple = (u32, i64);
@@ -107,7 +107,7 @@ enum Enum2 {
107107
type ChangeTypeEnum = Enum1;
108108

109109
#[cfg(not(cfail1))]
110-
#[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")]
110+
#[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
111111
#[rustc_clean(cfg="cfail3")]
112112
#[rustc_metadata_clean(cfg="cfail3")]
113113
type ChangeTypeEnum = Enum2;
@@ -119,7 +119,7 @@ type ChangeTypeEnum = Enum2;
119119
type AddTupleField = (i32, i64);
120120

121121
#[cfg(not(cfail1))]
122-
#[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")]
122+
#[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
123123
#[rustc_clean(cfg="cfail3")]
124124
#[rustc_metadata_clean(cfg="cfail3")]
125125
type AddTupleField = (i32, i64, i16);
@@ -131,7 +131,7 @@ type AddTupleField = (i32, i64, i16);
131131
type ChangeNestedTupleField = (i32, (i64, i16));
132132

133133
#[cfg(not(cfail1))]
134-
#[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")]
134+
#[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
135135
#[rustc_clean(cfg="cfail3")]
136136
#[rustc_metadata_clean(cfg="cfail3")]
137137
type ChangeNestedTupleField = (i32, (i64, i8));
@@ -143,7 +143,7 @@ type ChangeNestedTupleField = (i32, (i64, i8));
143143
type AddTypeParam<T1> = (T1, T1);
144144

145145
#[cfg(not(cfail1))]
146-
#[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")]
146+
#[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
147147
#[rustc_clean(cfg="cfail3")]
148148
#[rustc_metadata_clean(cfg="cfail3")]
149149
type AddTypeParam<T1, T2> = (T1, T2);
@@ -179,7 +179,7 @@ type AddTypeParamBoundWhereClause<T1> where T1: Clone+Copy = (T1, u32);
179179
type AddLifetimeParam<'a> = (&'a u32, &'a u32);
180180

181181
#[cfg(not(cfail1))]
182-
#[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")]
182+
#[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
183183
#[rustc_clean(cfg="cfail3")]
184184
#[rustc_metadata_clean(cfg="cfail3")]
185185
type AddLifetimeParam<'a, 'b> = (&'a u32, &'b u32);

0 commit comments

Comments
 (0)