1
Fork 0

Auto merge of #89836 - pierwill:fix-85142-crate-hash, r=wesleywiser

Include rustc version in `rustc_span::StableCrateId`

`rustc_span::def_id::StableCrateId` is a hash of various data about a crate during compilation. This PR includes the version of `rustc` in the input when computing this hash. From a cursory reading of [RFC 2603](https://rust-lang.github.io/rfcs/2603-rust-symbol-name-mangling-v0.html), this appears to be acceptable within that design.

In order to pass the `mir-opt` and `ui` test suites, this adds new [normalization for hashes and symbol names in `compiletest`](https://github.com/rust-lang/rust/pull/89836/files#diff-03a0567fa80ca04ed5a55f9ac5c711b4f84659be2d0ac4a984196d581c04f76b). These are enabled by default, but we might prefer it to be configurable.

In the UI tests, I had to truncate a significant amount of error annotations in v0 symbols (and maybe some legacy) in order to get the normalization to work correctly. (See https://github.com/rust-lang/rust/issues/90116.)

Closes #85142.
This commit is contained in:
bors 2021-12-16 02:21:30 +00:00
commit 9e1aff82e6
53 changed files with 333 additions and 205 deletions

View file

@ -2009,7 +2009,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
}
};
let mut def_ids: Vec<_> = defined_by
let def_ids: Vec<_> = defined_by
.values()
.flat_map(|region| match region {
Region::EarlyBound(_, def_id, _)
@ -2020,9 +2020,6 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
})
.collect();
// ensure that we issue lints in a repeatable order
def_ids.sort_by_cached_key(|&def_id| self.tcx.def_path_hash(def_id));
'lifetimes: for def_id in def_ids {
debug!("check_uses_for_lifetimes_defined_by_scope: def_id = {:?}", def_id);