Wrap SMIR bool and tuple into a Rigid variant

This commit is contained in:
Santiago Pastorino 2023-06-28 11:31:28 -03:00
parent 5ea6668646
commit 284df9fc34
No known key found for this signature in database
GPG Key ID: 8131A24E0C79EFAF
2 changed files with 10 additions and 5 deletions

View File

@ -7,7 +7,8 @@
//!
//! For now, we are developing everything inside `rustc`, thus, we keep this module private.
use crate::stable_mir::{self, ty::TyKind, Context};
use crate::stable_mir::ty::{RigidTy, TyKind};
use crate::stable_mir::{self, Context};
use rustc_middle::mir;
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_span::def_id::{CrateNum, DefId, LOCAL_CRATE};
@ -69,7 +70,7 @@ pub struct Tables<'tcx> {
impl<'tcx> Tables<'tcx> {
fn rustc_ty_to_ty(&mut self, ty: Ty<'tcx>) -> TyKind {
match ty.kind() {
ty::Bool => TyKind::Bool,
ty::Bool => TyKind::RigidTy(RigidTy::Bool),
ty::Char => todo!(),
ty::Int(_) => todo!(),
ty::Uint(_) => todo!(),
@ -90,9 +91,9 @@ fn rustc_ty_to_ty(&mut self, ty: Ty<'tcx>) -> TyKind {
ty::GeneratorWitness(_) => todo!(),
ty::GeneratorWitnessMIR(_, _) => todo!(),
ty::Never => todo!(),
ty::Tuple(fields) => {
TyKind::Tuple(fields.iter().map(|ty| self.intern_ty(ty)).collect())
}
ty::Tuple(fields) => TyKind::RigidTy(RigidTy::Tuple(
fields.iter().map(|ty| self.intern_ty(ty)).collect(),
)),
ty::Alias(_, _) => todo!(),
ty::Param(_) => todo!(),
ty::Bound(_, _) => todo!(),

View File

@ -10,6 +10,10 @@ pub fn kind(&self) -> TyKind {
}
pub enum TyKind {
RigidTy(RigidTy),
}
pub enum RigidTy {
Bool,
Tuple(Vec<Ty>),
}