diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2023-07-21 14:52:45 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2023-07-26 09:26:39 -0300 |
| commit | 7af1697138de14dbfebe75d37d83d035c29a2bf8 (patch) | |
| tree | 3ac873d2f6d9c4453132a68460a5fd10d5deac7e | |
| parent | 648cf070ebcb52a42fb2e10febace4e8027557c7 (diff) | |
| download | rust-7af1697138de14dbfebe75d37d83d035c29a2bf8.tar.gz rust-7af1697138de14dbfebe75d37d83d035c29a2bf8.zip | |
Add Bound ty to SMIR
| -rw-r--r-- | compiler/rustc_smir/src/rustc_smir/mod.rs | 12 | ||||
| -rw-r--r-- | compiler/rustc_smir/src/stable_mir/ty.rs | 7 |
2 files changed, 18 insertions, 1 deletions
diff --git a/compiler/rustc_smir/src/rustc_smir/mod.rs b/compiler/rustc_smir/src/rustc_smir/mod.rs index 0e7673d25fb..cefcab1e18f 100644 --- a/compiler/rustc_smir/src/rustc_smir/mod.rs +++ b/compiler/rustc_smir/src/rustc_smir/mod.rs @@ -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) } + } +} diff --git a/compiler/rustc_smir/src/stable_mir/ty.rs b/compiler/rustc_smir/src/stable_mir/ty.rs index 62dd02c1808..7a72afd666c 100644 --- a/compiler/rustc_smir/src/stable_mir/ty.rs +++ b/compiler/rustc_smir/src/stable_mir/ty.rs @@ -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, +} |
