Rollup merge of #64824 - Mark-Simulacrum:no-stable-hasher-result-everywhere, r=michaelwoerister
No StableHasherResult everywhere
This removes the generic parameter on `StableHasher`, instead moving it to the call to `finish`. This has the side-effect of making all `HashStable` impls nicer, since we no longer need the verbose `<W: StableHasherResult>` that previously existed -- often forcing line wrapping.
This is done for two reasons:
* we should avoid false "generic" dependency on the result of StableHasher
* we don't need to codegen two/three copies of all the HashStable impls when they're transitively used to produce a fingerprint, u64, or u128. I haven't measured, but this might actually make our artifacts somewhat smaller too.
* Easier to understand/read/write code -- the result of the stable hasher is irrelevant when writing a hash impl.
This commit is contained in:
commit
d7d7c2fce2
36 changed files with 191 additions and 472 deletions
|
|
@ -187,7 +187,7 @@ impl TypeMap<'ll, 'tcx> {
|
|||
|
||||
// The hasher we are using to generate the UniqueTypeId. We want
|
||||
// something that provides more than the 64 bits of the DefaultHasher.
|
||||
let mut hasher = StableHasher::<Fingerprint>::new();
|
||||
let mut hasher = StableHasher::new();
|
||||
let mut hcx = cx.tcx.create_stable_hashing_context();
|
||||
let type_ = cx.tcx.erase_regions(&type_);
|
||||
hcx.while_hashing_spans(false, |hcx| {
|
||||
|
|
@ -195,7 +195,7 @@ impl TypeMap<'ll, 'tcx> {
|
|||
type_.hash_stable(hcx, &mut hasher);
|
||||
});
|
||||
});
|
||||
let unique_type_id = hasher.finish().to_hex();
|
||||
let unique_type_id = hasher.finish::<Fingerprint>().to_hex();
|
||||
|
||||
let key = self.unique_id_interner.intern(&unique_type_id);
|
||||
self.type_to_unique_id.insert(type_, UniqueTypeId(key));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue