Auto merge of #110666 - JohnTitor:rollup-3pwilte, r=JohnTitor
Rollup of 7 pull requests Successful merges: - #109949 (rustdoc: migrate `document_type_layout` to askama) - #110622 (Stable hash tag (discriminant) of `GenericArg`) - #110635 (More `IS_ZST` in `library`) - #110640 (compiler/rustc_target: Raise m68k-linux-gnu baseline to 68020) - #110657 (nit: consistent naming for SimplifyConstCondition) - #110659 (rustdoc: clean up JS) - #110660 (Print ty placeholders pretty) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
3128fd8ddf
19 changed files with 200 additions and 180 deletions
|
@ -73,34 +73,6 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ty::subst::GenericArg<'t
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ty::subst::GenericArgKind<'tcx> {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
match self {
|
||||
// WARNING: We dedup cache the `HashStable` results for `List`
|
||||
// while ignoring types and freely transmute
|
||||
// between `List<Ty<'tcx>>` and `List<GenericArg<'tcx>>`.
|
||||
// See `fn mk_type_list` for more details.
|
||||
//
|
||||
// We therefore hash types without adding a hash for their discriminant.
|
||||
//
|
||||
// In order to make it very unlikely for the sequence of bytes being hashed for
|
||||
// a `GenericArgKind::Type` to be the same as the sequence of bytes being
|
||||
// hashed for one of the other variants, we hash some very high number instead
|
||||
// of their actual discriminant since `TyKind` should never start with anything
|
||||
// that high.
|
||||
ty::subst::GenericArgKind::Type(ty) => ty.hash_stable(hcx, hasher),
|
||||
ty::subst::GenericArgKind::Const(ct) => {
|
||||
0xF3u8.hash_stable(hcx, hasher);
|
||||
ct.hash_stable(hcx, hasher);
|
||||
}
|
||||
ty::subst::GenericArgKind::Lifetime(lt) => {
|
||||
0xF5u8.hash_stable(hcx, hasher);
|
||||
lt.hash_stable(hcx, hasher);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// AllocIds get resolved to whatever they point to (to be stable)
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for mir::interpret::AllocId {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
|
|
|
@ -738,7 +738,9 @@ pub trait PrettyPrinter<'tcx>:
|
|||
}
|
||||
}
|
||||
ty::Placeholder(placeholder) => match placeholder.bound.kind {
|
||||
ty::BoundTyKind::Anon => p!(write("Placeholder({:?})", placeholder)),
|
||||
ty::BoundTyKind::Anon => {
|
||||
self.pretty_print_placeholder_var(placeholder.universe, placeholder.bound.var)?
|
||||
}
|
||||
ty::BoundTyKind::Param(_, name) => p!(write("{}", name)),
|
||||
},
|
||||
ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs, .. }) => {
|
||||
|
@ -1172,6 +1174,18 @@ pub trait PrettyPrinter<'tcx>:
|
|||
}
|
||||
}
|
||||
|
||||
fn pretty_print_placeholder_var(
|
||||
&mut self,
|
||||
ui: ty::UniverseIndex,
|
||||
var: ty::BoundVar,
|
||||
) -> Result<(), Self::Error> {
|
||||
if ui == ty::UniverseIndex::ROOT {
|
||||
write!(self, "!{}", var.index())
|
||||
} else {
|
||||
write!(self, "!{}_{}", ui.index(), var.index())
|
||||
}
|
||||
}
|
||||
|
||||
fn ty_infer_name(&self, _: ty::TyVid) -> Option<Symbol> {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ const TYPE_TAG: usize = 0b00;
|
|||
const REGION_TAG: usize = 0b01;
|
||||
const CONST_TAG: usize = 0b10;
|
||||
|
||||
#[derive(Debug, TyEncodable, TyDecodable, PartialEq, Eq, PartialOrd, Ord)]
|
||||
#[derive(Debug, TyEncodable, TyDecodable, PartialEq, Eq, PartialOrd, Ord, HashStable)]
|
||||
pub enum GenericArgKind<'tcx> {
|
||||
Lifetime(ty::Region<'tcx>),
|
||||
Type(Ty<'tcx>),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue