Skip to content

Commit a8ad867

Browse files
authored
Rollup merge of #113639 - ericmarkmartin:more-smir-types, r=oli-obk
Add more ty conversions to smir add str, slice, and array to smir types r? `@spastorino`
2 parents 2a8ec6e + a167e66 commit a8ad867

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

compiler/rustc_smir/src/rustc_smir/mod.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,11 @@ impl<'tcx> Tables<'tcx> {
9696
},
9797
ty::Adt(_, _) => todo!(),
9898
ty::Foreign(_) => todo!(),
99-
ty::Str => todo!(),
100-
ty::Array(_, _) => todo!(),
101-
ty::Slice(_) => todo!(),
99+
ty::Str => TyKind::RigidTy(RigidTy::Str),
100+
ty::Array(ty, constant) => {
101+
TyKind::RigidTy(RigidTy::Array(self.intern_ty(*ty), opaque(constant)))
102+
}
103+
ty::Slice(ty) => TyKind::RigidTy(RigidTy::Slice(self.intern_ty(*ty))),
102104
ty::RawPtr(_) => todo!(),
103105
ty::Ref(_, _, _) => todo!(),
104106
ty::FnDef(_, _) => todo!(),

compiler/rustc_smir/src/stable_mir/ty.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
use super::with;
2+
use crate::rustc_internal::Opaque;
3+
4+
type Const = Opaque;
25

36
#[derive(Copy, Clone, Debug)]
47
pub struct Ty(pub usize);
@@ -21,6 +24,9 @@ pub enum RigidTy {
2124
Int(IntTy),
2225
Uint(UintTy),
2326
Float(FloatTy),
27+
Str,
28+
Array(Ty, Const),
29+
Slice(Ty),
2430
Tuple(Vec<Ty>),
2531
}
2632

0 commit comments

Comments
 (0)