Skip to content

Commit

Permalink
Rollup merge of rust-lang#113639 - ericmarkmartin:more-smir-types, r=…
Browse files Browse the repository at this point in the history
…oli-obk

Add more ty conversions to smir

add str, slice, and array to smir types

r? ``@spastorino``
  • Loading branch information
matthiaskrgr authored Jul 13, 2023
2 parents c5337c5 + a167e66 commit 96a8bad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 5 additions & 3 deletions compiler/rustc_smir/src/rustc_smir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ impl<'tcx> Tables<'tcx> {
},
ty::Adt(_, _) => todo!(),
ty::Foreign(_) => todo!(),
ty::Str => todo!(),
ty::Array(_, _) => todo!(),
ty::Slice(_) => todo!(),
ty::Str => TyKind::RigidTy(RigidTy::Str),
ty::Array(ty, constant) => {
TyKind::RigidTy(RigidTy::Array(self.intern_ty(*ty), opaque(constant)))
}
ty::Slice(ty) => TyKind::RigidTy(RigidTy::Slice(self.intern_ty(*ty))),
ty::RawPtr(_) => todo!(),
ty::Ref(_, _, _) => todo!(),
ty::FnDef(_, _) => todo!(),
Expand Down
6 changes: 6 additions & 0 deletions compiler/rustc_smir/src/stable_mir/ty.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use super::with;
use crate::rustc_internal::Opaque;

type Const = Opaque;

#[derive(Copy, Clone, Debug)]
pub struct Ty(pub usize);
Expand All @@ -21,6 +24,9 @@ pub enum RigidTy {
Int(IntTy),
Uint(UintTy),
Float(FloatTy),
Str,
Array(Ty, Const),
Slice(Ty),
Tuple(Vec<Ty>),
}

Expand Down

0 comments on commit 96a8bad

Please sign in to comment.