Skip to content

Commit 7af1697

Browse files
committed
Add Bound ty to SMIR
1 parent 648cf07 commit 7af1697

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

compiler/rustc_smir/src/rustc_smir/mod.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,9 @@ impl<'tcx> Stable<'tcx> for Ty<'tcx> {
826826
TyKind::Alias(alias_kind.stable(tables), alias_ty.stable(tables))
827827
}
828828
ty::Param(param_ty) => TyKind::Param(param_ty.stable(tables)),
829-
ty::Bound(_, _) => todo!(),
829+
ty::Bound(debruijn_idx, bound_ty) => {
830+
TyKind::Bound(debruijn_idx.as_usize(), bound_ty.stable(tables))
831+
}
830832
ty::Placeholder(..)
831833
| ty::GeneratorWitness(_)
832834
| ty::GeneratorWitnessMIR(_, _)
@@ -845,3 +847,11 @@ impl<'tcx> Stable<'tcx> for rustc_middle::ty::ParamTy {
845847
ParamTy { index: self.index, name: self.name.to_string() }
846848
}
847849
}
850+
851+
impl<'tcx> Stable<'tcx> for rustc_middle::ty::BoundTy {
852+
type T = stable_mir::ty::BoundTy;
853+
fn stable(&self, tables: &mut Tables<'tcx>) -> Self::T {
854+
use stable_mir::ty::BoundTy;
855+
BoundTy { var: self.var.as_usize(), kind: self.kind.stable(tables) }
856+
}
857+
}

compiler/rustc_smir/src/stable_mir/ty.rs

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub enum TyKind {
1919
RigidTy(RigidTy),
2020
Alias(AliasKind, AliasTy),
2121
Param(ParamTy),
22+
Bound(usize, BoundTy),
2223
}
2324

2425
#[derive(Clone, Debug)]
@@ -235,3 +236,9 @@ pub struct ParamTy {
235236
pub index: u32,
236237
pub name: String,
237238
}
239+
240+
#[derive(Clone, Debug)]
241+
pub struct BoundTy {
242+
pub var: usize,
243+
pub kind: BoundTyKind,
244+
}

0 commit comments

Comments
 (0)