Skip to content

Commit c8ee46b

Browse files
conversions to smir RawPtr and Ref
1 parent 08e89ac commit c8ee46b

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

compiler/rustc_smir/src/rustc_smir/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ impl<'tcx> Tables<'tcx> {
122122
ty::RawPtr(ty::TypeAndMut { ty, mutbl }) => {
123123
TyKind::RigidTy(RigidTy::RawPtr(self.intern_ty(*ty), mutbl.stable()))
124124
}
125-
ty::Ref(_, _, _) => todo!(),
125+
ty::Ref(region, ty, mutbl) => {
126+
TyKind::RigidTy(RigidTy::Ref(opaque(region), self.intern_ty(*ty), mutbl.stable()))
127+
}
126128
ty::FnDef(_, _) => todo!(),
127129
ty::FnPtr(_) => todo!(),
128130
ty::Dynamic(_, _, _) => todo!(),

compiler/rustc_smir/src/stable_mir/mir/body.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::rustc_internal::Opaque;
1+
use crate::stable_mir::ty::Region;
22
use crate::stable_mir::{self, ty::Ty};
33

44
#[derive(Clone, Debug)]
@@ -137,8 +137,6 @@ pub enum Statement {
137137
Nop,
138138
}
139139

140-
type Region = Opaque;
141-
142140
// FIXME this is incomplete
143141
#[derive(Clone, Debug)]
144142
pub enum Rvalue {

compiler/rustc_smir/src/stable_mir/ty.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
use super::{with, DefId};
1+
use super::{mir::Mutability, with, DefId};
22
use crate::rustc_internal::Opaque;
33

4-
type Const = Opaque;
5-
64
#[derive(Copy, Clone, Debug)]
75
pub struct Ty(pub usize);
86

@@ -13,15 +11,13 @@ impl Ty {
1311
}
1412

1513
type Const = Opaque;
16-
type Region = Opaque;
14+
pub(crate) type Region = Opaque;
1715

1816
#[derive(Clone, Debug)]
1917
pub enum TyKind {
2018
RigidTy(RigidTy),
2119
}
2220

23-
type Region = Opaque;
24-
2521
#[derive(Clone, Debug)]
2622
pub enum RigidTy {
2723
Bool,
@@ -34,6 +30,7 @@ pub enum RigidTy {
3430
Array(Ty, Const),
3531
Slice(Ty),
3632
RawPtr(Ty, Mutability),
33+
Ref(Region, Ty, Mutability),
3734
Tuple(Vec<Ty>),
3835
}
3936

0 commit comments

Comments
 (0)