Skip to content

Commit fd5553f

Browse files
add str, slice, and array to smir types
1 parent 7bd81ee commit fd5553f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

compiler/rustc_smir/src/rustc_smir/mod.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,11 @@ impl<'tcx> Tables<'tcx> {
114114
),
115115
)),
116116
ty::Foreign(_) => todo!(),
117-
ty::Str => todo!(),
118-
ty::Array(_, _) => todo!(),
119-
ty::Slice(_) => todo!(),
117+
ty::Str => TyKind::RigidTy(RigidTy::Str),
118+
ty::Array(ty, constant) => {
119+
TyKind::RigidTy(RigidTy::Array(self.intern_ty(*ty), opaque(constant)))
120+
}
121+
ty::Slice(ty) => TyKind::RigidTy(RigidTy::Slice(self.intern_ty(*ty))),
120122
ty::RawPtr(_) => todo!(),
121123
ty::Ref(_, _, _) => todo!(),
122124
ty::FnDef(_, _) => todo!(),

compiler/rustc_smir/src/stable_mir/ty.rs

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ pub enum RigidTy {
2626
Uint(UintTy),
2727
Float(FloatTy),
2828
Adt(AdtDef, AdtSubsts),
29+
Str,
30+
Array(Ty, Const),
31+
Slice(Ty),
2932
Tuple(Vec<Ty>),
3033
}
3134

0 commit comments

Comments
 (0)