conversions to smir RawPtr and Ref

This commit is contained in:
Eric Mark Martin 2023-07-13 01:07:50 -04:00
parent 08e89acd2e
commit c8ee46be75
3 changed files with 7 additions and 10 deletions

View File

@ -122,7 +122,9 @@ impl<'tcx> Tables<'tcx> {
ty::RawPtr(ty::TypeAndMut { ty, mutbl }) => { ty::RawPtr(ty::TypeAndMut { ty, mutbl }) => {
TyKind::RigidTy(RigidTy::RawPtr(self.intern_ty(*ty), mutbl.stable())) TyKind::RigidTy(RigidTy::RawPtr(self.intern_ty(*ty), mutbl.stable()))
} }
ty::Ref(_, _, _) => todo!(), ty::Ref(region, ty, mutbl) => {
TyKind::RigidTy(RigidTy::Ref(opaque(region), self.intern_ty(*ty), mutbl.stable()))
}
ty::FnDef(_, _) => todo!(), ty::FnDef(_, _) => todo!(),
ty::FnPtr(_) => todo!(), ty::FnPtr(_) => todo!(),
ty::Dynamic(_, _, _) => todo!(), ty::Dynamic(_, _, _) => todo!(),

View File

@ -1,4 +1,4 @@
use crate::rustc_internal::Opaque; use crate::stable_mir::ty::Region;
use crate::stable_mir::{self, ty::Ty}; use crate::stable_mir::{self, ty::Ty};
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
@ -137,8 +137,6 @@ pub enum Statement {
Nop, Nop,
} }
type Region = Opaque;
// FIXME this is incomplete // FIXME this is incomplete
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum Rvalue { pub enum Rvalue {

View File

@ -1,8 +1,6 @@
use super::{with, DefId}; use super::{mir::Mutability, with, DefId};
use crate::rustc_internal::Opaque; use crate::rustc_internal::Opaque;
type Const = Opaque;
#[derive(Copy, Clone, Debug)] #[derive(Copy, Clone, Debug)]
pub struct Ty(pub usize); pub struct Ty(pub usize);
@ -13,15 +11,13 @@ impl Ty {
} }
type Const = Opaque; type Const = Opaque;
type Region = Opaque; pub(crate) type Region = Opaque;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum TyKind { pub enum TyKind {
RigidTy(RigidTy), RigidTy(RigidTy),
} }
type Region = Opaque;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum RigidTy { pub enum RigidTy {
Bool, Bool,
@ -34,6 +30,7 @@ pub enum RigidTy {
Array(Ty, Const), Array(Ty, Const),
Slice(Ty), Slice(Ty),
RawPtr(Ty, Mutability), RawPtr(Ty, Mutability),
Ref(Region, Ty, Mutability),
Tuple(Vec<Ty>), Tuple(Vec<Ty>),
} }