update region debug formatting

This commit is contained in:
Boxy
2024-03-12 15:53:35 +00:00
parent 13abc0ac9b
commit 8124b26122
32 changed files with 201 additions and 164 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 {