Skip to content

Commit 284df9f

Browse files
committed
Wrap SMIR bool and tuple into a Rigid variant
1 parent 5ea6668 commit 284df9f

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

compiler/rustc_smir/src/rustc_smir/mod.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
//!
88
//! For now, we are developing everything inside `rustc`, thus, we keep this module private.
99
10-
use crate::stable_mir::{self, ty::TyKind, Context};
10+
use crate::stable_mir::ty::{RigidTy, TyKind};
11+
use crate::stable_mir::{self, Context};
1112
use rustc_middle::mir;
1213
use rustc_middle::ty::{self, Ty, TyCtxt};
1314
use rustc_span::def_id::{CrateNum, DefId, LOCAL_CRATE};
@@ -69,7 +70,7 @@ pub struct Tables<'tcx> {
6970
impl<'tcx> Tables<'tcx> {
7071
fn rustc_ty_to_ty(&mut self, ty: Ty<'tcx>) -> TyKind {
7172
match ty.kind() {
72-
ty::Bool => TyKind::Bool,
73+
ty::Bool => TyKind::RigidTy(RigidTy::Bool),
7374
ty::Char => todo!(),
7475
ty::Int(_) => todo!(),
7576
ty::Uint(_) => todo!(),
@@ -90,9 +91,9 @@ impl<'tcx> Tables<'tcx> {
9091
ty::GeneratorWitness(_) => todo!(),
9192
ty::GeneratorWitnessMIR(_, _) => todo!(),
9293
ty::Never => todo!(),
93-
ty::Tuple(fields) => {
94-
TyKind::Tuple(fields.iter().map(|ty| self.intern_ty(ty)).collect())
95-
}
94+
ty::Tuple(fields) => TyKind::RigidTy(RigidTy::Tuple(
95+
fields.iter().map(|ty| self.intern_ty(ty)).collect(),
96+
)),
9697
ty::Alias(_, _) => todo!(),
9798
ty::Param(_) => todo!(),
9899
ty::Bound(_, _) => todo!(),

compiler/rustc_smir/src/stable_mir/ty.rs

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ impl Ty {
1010
}
1111

1212
pub enum TyKind {
13+
RigidTy(RigidTy),
14+
}
15+
16+
pub enum RigidTy {
1317
Bool,
1418
Tuple(Vec<Ty>),
1519
}

0 commit comments

Comments
 (0)