1
Fork 0

Add Bound ty to SMIR

This commit is contained in:
Santiago Pastorino 2023-07-21 14:52:45 -03:00
parent 648cf070eb
commit 7af1697138
No known key found for this signature in database
GPG key ID: 8131A24E0C79EFAF
2 changed files with 18 additions and 1 deletions

View file

@ -826,7 +826,9 @@ impl<'tcx> Stable<'tcx> for Ty<'tcx> {
TyKind::Alias(alias_kind.stable(tables), alias_ty.stable(tables))
}
ty::Param(param_ty) => TyKind::Param(param_ty.stable(tables)),
ty::Bound(_, _) => todo!(),
ty::Bound(debruijn_idx, bound_ty) => {
TyKind::Bound(debruijn_idx.as_usize(), bound_ty.stable(tables))
}
ty::Placeholder(..)
| ty::GeneratorWitness(_)
| ty::GeneratorWitnessMIR(_, _)
@ -845,3 +847,11 @@ impl<'tcx> Stable<'tcx> for rustc_middle::ty::ParamTy {
ParamTy { index: self.index, name: self.name.to_string() }
}
}
impl<'tcx> Stable<'tcx> for rustc_middle::ty::BoundTy {
type T = stable_mir::ty::BoundTy;
fn stable(&self, tables: &mut Tables<'tcx>) -> Self::T {
use stable_mir::ty::BoundTy;
BoundTy { var: self.var.as_usize(), kind: self.kind.stable(tables) }
}
}

View file

@ -19,6 +19,7 @@ pub enum TyKind {
RigidTy(RigidTy),
Alias(AliasKind, AliasTy),
Param(ParamTy),
Bound(usize, BoundTy),
}
#[derive(Clone, Debug)]
@ -235,3 +236,9 @@ pub struct ParamTy {
pub index: u32,
pub name: String,
}
#[derive(Clone, Debug)]
pub struct BoundTy {
pub var: usize,
pub kind: BoundTyKind,
}