Skip to content

Commit d3e0c33

Browse files
committed
modify inherent impls test to indicate TypeckTables do not change
I also added some comments explaining what is going on. In short, the changes in question do not, in fact, affect the`TypeckTables` in any semantic way. However, altering the order of lowering can cause it appear to affect the `TypeckTables`: if we lower generics before the body, then the `HirId` for things in the body will be affected. In this case, we are now lowering the generics etc *after* the body, so the hash no longer changes. This seems good.
1 parent 78ccbba commit d3e0c33

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

src/test/incremental/hashes/inherent_impls.rs

+40-4
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,16 @@ impl Foo {
370370
#[rustc_metadata_clean(cfg="cfail2")]
371371
#[rustc_metadata_clean(cfg="cfail3")]
372372
impl Foo {
373-
#[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeckTables")]
373+
// Warning: Note that `TypeckTables` are coming up clean here.
374+
// The addition or removal of lifetime parameters that don't
375+
// appear in the arguments or fn body in any way does not, in
376+
// fact, affect the `TypeckTables` in any semantic way (at least
377+
// as of this writing). **However,** altering the order of
378+
// lowering **can** cause it appear to affect the `TypeckTables`:
379+
// if we lower generics before the body, then the `HirId` for
380+
// things in the body will be affected. So if you start to see
381+
// `TypeckTables` appear dirty, that might be the cause. -nmatsakis
382+
#[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
374383
#[rustc_clean(cfg="cfail3")]
375384
#[rustc_metadata_clean(cfg="cfail2")]
376385
#[rustc_metadata_clean(cfg="cfail3")]
@@ -391,9 +400,18 @@ impl Foo {
391400
#[rustc_metadata_clean(cfg="cfail2")]
392401
#[rustc_metadata_clean(cfg="cfail3")]
393402
impl Foo {
403+
// Warning: Note that `TypeckTables` are coming up clean here.
404+
// The addition or removal of type parameters that don't appear in
405+
// the arguments or fn body in any way does not, in fact, affect
406+
// the `TypeckTables` in any semantic way (at least as of this
407+
// writing). **However,** altering the order of lowering **can**
408+
// cause it appear to affect the `TypeckTables`: if we lower
409+
// generics before the body, then the `HirId` for things in the
410+
// body will be affected. So if you start to see `TypeckTables`
411+
// appear dirty, that might be the cause. -nmatsakis
394412
#[rustc_clean(
395413
cfg="cfail2",
396-
except="Hir,HirBody,GenericsOfItem,PredicatesOfItem,TypeOfItem,TypeckTables",
414+
except="Hir,HirBody,GenericsOfItem,PredicatesOfItem,TypeOfItem",
397415
)]
398416
#[rustc_clean(cfg="cfail3")]
399417
#[rustc_metadata_dirty(cfg="cfail2")]
@@ -439,8 +457,17 @@ impl Foo {
439457
#[rustc_metadata_clean(cfg="cfail2")]
440458
#[rustc_metadata_clean(cfg="cfail3")]
441459
impl Foo {
460+
// Warning: Note that `TypeckTables` are coming up clean here.
461+
// The addition or removal of bounds that don't appear in the
462+
// arguments or fn body in any way does not, in fact, affect the
463+
// `TypeckTables` in any semantic way (at least as of this
464+
// writing). **However,** altering the order of lowering **can**
465+
// cause it appear to affect the `TypeckTables`: if we lower
466+
// generics before the body, then the `HirId` for things in the
467+
// body will be affected. So if you start to see `TypeckTables`
468+
// appear dirty, that might be the cause. -nmatsakis
442469
#[rustc_clean(cfg="cfail2", except="Hir,HirBody,GenericsOfItem,PredicatesOfItem,\
443-
TypeOfItem,TypeckTables")]
470+
TypeOfItem")]
444471
#[rustc_clean(cfg="cfail3")]
445472
#[rustc_metadata_dirty(cfg="cfail2")]
446473
#[rustc_metadata_clean(cfg="cfail3")]
@@ -461,7 +488,16 @@ impl Foo {
461488
#[rustc_metadata_clean(cfg="cfail2")]
462489
#[rustc_metadata_clean(cfg="cfail3")]
463490
impl Foo {
464-
#[rustc_clean(cfg="cfail2", except="Hir,HirBody,PredicatesOfItem,TypeckTables")]
491+
// Warning: Note that `TypeckTables` are coming up clean here.
492+
// The addition or removal of bounds that don't appear in the
493+
// arguments or fn body in any way does not, in fact, affect the
494+
// `TypeckTables` in any semantic way (at least as of this
495+
// writing). **However,** altering the order of lowering **can**
496+
// cause it appear to affect the `TypeckTables`: if we lower
497+
// generics before the body, then the `HirId` for things in the
498+
// body will be affected. So if you start to see `TypeckTables`
499+
// appear dirty, that might be the cause. -nmatsakis
500+
#[rustc_clean(cfg="cfail2", except="Hir,HirBody,PredicatesOfItem")]
465501
#[rustc_clean(cfg="cfail3")]
466502
#[rustc_metadata_dirty(cfg="cfail2")]
467503
#[rustc_metadata_clean(cfg="cfail3")]

0 commit comments

Comments
 (0)