1
Fork 0

Auto merge of #122392 - BoxyUwU:misc_cleanup, r=lcnr

misc cleanups from debugging something

rename `instantiate_canonical_with_fresh_inference_vars` to `instantiate_canonical`  the substs for the canonical are not solely infer vars as that would be wildly wrong and it is rather confusing to see this method called and think that the entire canonicalization setup is completely broken when it is not 👍

also update region debug printing to be more like the custom impls for Ty/Const, right now regions in debug output are horribly verbose and make it incredibly hard to read but with this atleast boundvars and placeholders when debugging the new solver do not take up excessive amounts of space.

r? `@lcnr`
This commit is contained in:
bors 2024-03-19 15:38:41 +00:00
commit a385e5667c
38 changed files with 212 additions and 180 deletions

View file

@ -336,7 +336,9 @@ pub struct EarlyParamRegion {
impl std::fmt::Debug for EarlyParamRegion {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}, {}, {}", self.def_id, self.index, self.name)
// FIXME(BoxyUwU): self.def_id goes first because of `erased-regions-in-hidden-ty.rs` being impossible to write
// error annotations for otherwise. :). Ideally this would be `self.name, self.index, self.def_id`.
write!(f, "{:?}_{}/#{}", self.def_id, self.name, self.index)
}
}
@ -381,13 +383,25 @@ pub enum BoundRegionKind {
BrEnv,
}
#[derive(Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable, Debug, PartialOrd, Ord)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable, PartialOrd, Ord)]
#[derive(HashStable)]
pub struct BoundRegion {
pub var: BoundVar,
pub kind: BoundRegionKind,
}
impl core::fmt::Debug for BoundRegion {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self.kind {
BoundRegionKind::BrAnon => write!(f, "{:?}", self.var),
BoundRegionKind::BrEnv => write!(f, "{:?}.Env", self.var),
BoundRegionKind::BrNamed(def, symbol) => {
write!(f, "{:?}.Named({:?}, {:?})", self.var, def, symbol)
}
}
}
}
impl BoundRegionKind {
pub fn is_named(&self) -> bool {
match *self {