1
Fork 0

Uplift RegionVid

This commit is contained in:
Michael Goulet 2024-05-19 12:42:22 -04:00
parent 75cb5c51cd
commit 569fb43aa0
12 changed files with 75 additions and 64 deletions

View file

@ -134,7 +134,6 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
type EarlyParamRegion = ty::EarlyParamRegion;
type LateParamRegion = ty::LateParamRegion;
type BoundRegion = ty::BoundRegion;
type InferRegion = ty::RegionVid;
type PlaceholderRegion = ty::PlaceholderRegion;
type ParamEnv = ty::ParamEnv<'tcx>;

View file

@ -1,13 +1,12 @@
use polonius_engine::Atom;
use rustc_data_structures::intern::Interned;
use rustc_errors::MultiSpan;
use rustc_hir::def_id::DefId;
use rustc_index::Idx;
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
use rustc_span::symbol::sym;
use rustc_span::symbol::{kw, Symbol};
use rustc_span::{ErrorGuaranteed, DUMMY_SP};
use rustc_type_ir::RegionKind as IrRegionKind;
pub use rustc_type_ir::RegionVid;
use std::ops::Deref;
use crate::ty::{self, BoundVar, TyCtxt, TypeFlags};
@ -348,21 +347,6 @@ impl std::fmt::Debug for EarlyParamRegion {
}
}
rustc_index::newtype_index! {
/// A **region** (lifetime) **v**ariable **ID**.
#[derive(HashStable)]
#[encodable]
#[orderable]
#[debug_format = "'?{}"]
pub struct RegionVid {}
}
impl Atom for RegionVid {
fn index(self) -> usize {
Idx::index(self)
}
}
#[derive(Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable, Copy)]
#[derive(HashStable)]
/// The parameter representation of late-bound function parameters, "some region

View file

@ -259,18 +259,6 @@ impl<'tcx> DebugWithInfcx<TyCtxt<'tcx>> for Region<'tcx> {
}
}
impl<'tcx> DebugWithInfcx<TyCtxt<'tcx>> for ty::RegionVid {
fn fmt<Infcx: InferCtxtLike<Interner = TyCtxt<'tcx>>>(
this: WithInfcx<'_, Infcx, &Self>,
f: &mut core::fmt::Formatter<'_>,
) -> core::fmt::Result {
match this.infcx.universe_of_lt(*this.data) {
Some(universe) => write!(f, "'?{}_{}", this.data.index(), universe.index()),
None => write!(f, "{:?}", this.data),
}
}
}
impl<'tcx, T: DebugWithInfcx<TyCtxt<'tcx>>> DebugWithInfcx<TyCtxt<'tcx>> for ty::Binder<'tcx, T> {
fn fmt<Infcx: InferCtxtLike<Interner = TyCtxt<'tcx>>>(
this: WithInfcx<'_, Infcx, &Self>,