update region debug formatting
This commit is contained in:
parent
13abc0ac9b
commit
8124b26122
32 changed files with 201 additions and 164 deletions
|
@ -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 {
|
||||
|
|
|
@ -223,23 +223,27 @@ impl<I: Interner> DebugWithInfcx<I> for RegionKind<I> {
|
|||
f: &mut core::fmt::Formatter<'_>,
|
||||
) -> core::fmt::Result {
|
||||
match this.data {
|
||||
ReEarlyParam(data) => write!(f, "ReEarlyParam({data:?})"),
|
||||
ReEarlyParam(data) => write!(f, "{data:?}"),
|
||||
|
||||
ReBound(binder_id, bound_region) => {
|
||||
write!(f, "ReBound({binder_id:?}, {bound_region:?})")
|
||||
write!(f, "'")?;
|
||||
crate::debug_bound_var(f, *binder_id, bound_region)
|
||||
}
|
||||
|
||||
ReLateParam(fr) => write!(f, "{fr:?}"),
|
||||
|
||||
ReStatic => f.write_str("ReStatic"),
|
||||
ReStatic => f.write_str("'static"),
|
||||
|
||||
ReVar(vid) => write!(f, "{:?}", &this.wrap(vid)),
|
||||
|
||||
RePlaceholder(placeholder) => write!(f, "RePlaceholder({placeholder:?})"),
|
||||
RePlaceholder(placeholder) => write!(f, "{placeholder:?}"),
|
||||
|
||||
ReErased => f.write_str("ReErased"),
|
||||
// Use `'{erased}` as the output instead of `'erased` so that its more obviously distinct from
|
||||
// a `ReEarlyParam` named `'erased`. Technically that would print as `'erased/#IDX` so this is
|
||||
// not strictly necessary but *shrug*
|
||||
ReErased => f.write_str("'{erased}"),
|
||||
|
||||
ReError(_) => f.write_str("ReError"),
|
||||
ReError(_) => f.write_str("'{region error}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue