diff options
| author | bors <bors@rust-lang.org> | 2022-11-13 06:23:18 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-11-13 06:23:18 +0000 |
| commit | 3be81dd0cedef3c83fba7047857418633708890f (patch) | |
| tree | 88e84d7ca6d878c9e4b51b9afd8aeb6a3a235609 /compiler/rustc_middle/src | |
| parent | 229e875878a682411df8b8adae39372302d2b4c7 (diff) | |
| parent | ba46b6837367204e0ae4ba020a788df06dc2ebd8 (diff) | |
Auto merge of #104282 - cjgillot:intern-span, r=compiler-errors
Hash spans when interning types Ignoring hash for spans creates an inconsistency between the `Hash` impl for `WithStableHash`, which takes them into account, and the `HashStable` impl which does not. cc `@compiler-errors` Fixes https://github.com/rust-lang/rust/issues/104271 Fixes https://github.com/rust-lang/rust/issues/104255 Fixes https://github.com/rust-lang/rust/issues/104238
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/ty/context.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/print/pretty.rs | 44 |
2 files changed, 7 insertions, 45 deletions
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 2a93df771e1..8f96f5a9eb3 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -198,12 +198,8 @@ impl<'tcx> CtxtInterners<'tcx> { Fingerprint::ZERO } else { let mut hasher = StableHasher::new(); - let mut hcx = StableHashingContext::ignore_spans( - sess, - definitions, - cstore, - source_span, - ); + let mut hcx = + StableHashingContext::new(sess, definitions, cstore, source_span); kind.hash_stable(&mut hcx, &mut hasher); hasher.finish() }; diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 2432b517519..48e803597b0 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -2225,46 +2225,12 @@ impl<'tcx> FmtPrinter<'_, 'tcx> { // this is not *quite* right and changes the ordering of some output // anyways. let (new_value, map) = if self.should_print_verbose() { - let regions: Vec<_> = value - .bound_vars() - .into_iter() - .map(|var| { - let ty::BoundVariableKind::Region(var) = var else { - // This doesn't really matter because it doesn't get used, - // it's just an empty value - return ty::BrAnon(0, None); - }; - match var { - ty::BrAnon(..) | ty::BrEnv => { - start_or_continue(&mut self, "for<", ", "); - let name = next_name(&self); - debug!(?name); - do_continue(&mut self, name); - ty::BrNamed(CRATE_DEF_ID.to_def_id(), name) - } - ty::BrNamed(def_id, kw::UnderscoreLifetime) => { - start_or_continue(&mut self, "for<", ", "); - let name = next_name(&self); - do_continue(&mut self, name); - ty::BrNamed(def_id, name) - } - ty::BrNamed(def_id, name) => { - start_or_continue(&mut self, "for<", ", "); - do_continue(&mut self, name); - ty::BrNamed(def_id, name) - } - } - }) - .collect(); + for var in value.bound_vars().iter() { + start_or_continue(&mut self, "for<", ", "); + write!(self, "{:?}", var)?; + } start_or_continue(&mut self, "", "> "); - - self.tcx.replace_late_bound_regions(value.clone(), |br| { - let kind = regions[br.var.as_usize()]; - self.tcx.mk_region(ty::ReLateBound( - ty::INNERMOST, - ty::BoundRegion { var: br.var, kind }, - )) - }) + (value.clone().skip_binder(), BTreeMap::default()) } else { let tcx = self.tcx; |
