Skip to content

Commit 648cf07

Browse files
committed
Add Param ty to SMIR
1 parent a6236fa commit 648cf07

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

compiler/rustc_smir/src/rustc_smir/mod.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ impl<'tcx> Stable<'tcx> for Ty<'tcx> {
825825
ty::Alias(alias_kind, alias_ty) => {
826826
TyKind::Alias(alias_kind.stable(tables), alias_ty.stable(tables))
827827
}
828-
ty::Param(_) => todo!(),
828+
ty::Param(param_ty) => TyKind::Param(param_ty.stable(tables)),
829829
ty::Bound(_, _) => todo!(),
830830
ty::Placeholder(..)
831831
| ty::GeneratorWitness(_)
@@ -837,3 +837,11 @@ impl<'tcx> Stable<'tcx> for Ty<'tcx> {
837837
}
838838
}
839839
}
840+
841+
impl<'tcx> Stable<'tcx> for rustc_middle::ty::ParamTy {
842+
type T = stable_mir::ty::ParamTy;
843+
fn stable(&self, _: &mut Tables<'tcx>) -> Self::T {
844+
use stable_mir::ty::ParamTy;
845+
ParamTy { index: self.index, name: self.name.to_string() }
846+
}
847+
}

compiler/rustc_smir/src/stable_mir/ty.rs

+7
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ type Span = Opaque;
1818
pub enum TyKind {
1919
RigidTy(RigidTy),
2020
Alias(AliasKind, AliasTy),
21+
Param(ParamTy),
2122
}
2223

2324
#[derive(Clone, Debug)]
@@ -228,3 +229,9 @@ pub struct ExistentialProjection {
228229
pub generic_args: GenericArgs,
229230
pub term: TermKind,
230231
}
232+
233+
#[derive(Clone, Debug)]
234+
pub struct ParamTy {
235+
pub index: u32,
236+
pub name: String,
237+
}

0 commit comments

Comments
 (0)