1
Fork 0

split out AliasTy -> AliasTerm

This commit is contained in:
Michael Goulet 2024-05-13 10:00:38 -04:00
parent ecbe3fd550
commit 3bcdf3058e
70 changed files with 715 additions and 414 deletions

View file

@ -9,7 +9,7 @@ use stable_mir::ty::{
use crate::rustc_smir::{alloc, Stable, Tables};
impl<'tcx> Stable<'tcx> for ty::AliasKind {
impl<'tcx> Stable<'tcx> for ty::AliasTyKind {
type T = stable_mir::ty::AliasKind;
fn stable(&self, _: &mut Tables<'_>) -> Self::T {
match self {
@ -29,6 +29,14 @@ impl<'tcx> Stable<'tcx> for ty::AliasTy<'tcx> {
}
}
impl<'tcx> Stable<'tcx> for ty::AliasTerm<'tcx> {
type T = stable_mir::ty::AliasTerm;
fn stable(&self, tables: &mut Tables<'_>) -> Self::T {
let ty::AliasTerm { args, def_id, .. } = self;
stable_mir::ty::AliasTerm { def_id: tables.alias_def(*def_id), args: args.stable(tables) }
}
}
impl<'tcx> Stable<'tcx> for ty::DynKind {
type T = stable_mir::ty::DynKind;
@ -715,9 +723,9 @@ impl<'tcx> Stable<'tcx> for ty::ProjectionPredicate<'tcx> {
type T = stable_mir::ty::ProjectionPredicate;
fn stable(&self, tables: &mut Tables<'_>) -> Self::T {
let ty::ProjectionPredicate { projection_ty, term } = self;
let ty::ProjectionPredicate { projection_term: projection_ty, term } = self;
stable_mir::ty::ProjectionPredicate {
projection_ty: projection_ty.stable(tables),
projection_term: projection_ty.stable(tables),
term: term.unpack().stable(tables),
}
}