7
7
//!
8
8
//! For now, we are developing everything inside `rustc`, thus, we keep this module private.
9
9
10
- use crate :: stable_mir:: { self , ty:: TyKind , Context } ;
10
+ use crate :: stable_mir:: ty:: { FloatTy , IntTy , RigidTy , TyKind , UintTy } ;
11
+ use crate :: stable_mir:: { self , Context } ;
11
12
use rustc_middle:: mir;
12
13
use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
13
14
use rustc_span:: def_id:: { CrateNum , DefId , LOCAL_CRATE } ;
@@ -69,11 +70,28 @@ pub struct Tables<'tcx> {
69
70
impl < ' tcx > Tables < ' tcx > {
70
71
fn rustc_ty_to_ty ( & mut self , ty : Ty < ' tcx > ) -> TyKind {
71
72
match ty. kind ( ) {
72
- ty:: Bool => TyKind :: Bool ,
73
- ty:: Char => todo ! ( ) ,
74
- ty:: Int ( _) => todo ! ( ) ,
75
- ty:: Uint ( _) => todo ! ( ) ,
76
- ty:: Float ( _) => todo ! ( ) ,
73
+ ty:: Bool => TyKind :: RigidTy ( RigidTy :: Bool ) ,
74
+ ty:: Char => TyKind :: RigidTy ( RigidTy :: Char ) ,
75
+ ty:: Int ( int_ty) => match int_ty {
76
+ ty:: IntTy :: Isize => TyKind :: RigidTy ( RigidTy :: Int ( IntTy :: Isize ) ) ,
77
+ ty:: IntTy :: I8 => TyKind :: RigidTy ( RigidTy :: Int ( IntTy :: I8 ) ) ,
78
+ ty:: IntTy :: I16 => TyKind :: RigidTy ( RigidTy :: Int ( IntTy :: I16 ) ) ,
79
+ ty:: IntTy :: I32 => TyKind :: RigidTy ( RigidTy :: Int ( IntTy :: I32 ) ) ,
80
+ ty:: IntTy :: I64 => TyKind :: RigidTy ( RigidTy :: Int ( IntTy :: I64 ) ) ,
81
+ ty:: IntTy :: I128 => TyKind :: RigidTy ( RigidTy :: Int ( IntTy :: I128 ) ) ,
82
+ } ,
83
+ ty:: Uint ( uint_ty) => match uint_ty {
84
+ ty:: UintTy :: Usize => TyKind :: RigidTy ( RigidTy :: Uint ( UintTy :: Usize ) ) ,
85
+ ty:: UintTy :: U8 => TyKind :: RigidTy ( RigidTy :: Uint ( UintTy :: U8 ) ) ,
86
+ ty:: UintTy :: U16 => TyKind :: RigidTy ( RigidTy :: Uint ( UintTy :: U16 ) ) ,
87
+ ty:: UintTy :: U32 => TyKind :: RigidTy ( RigidTy :: Uint ( UintTy :: U32 ) ) ,
88
+ ty:: UintTy :: U64 => TyKind :: RigidTy ( RigidTy :: Uint ( UintTy :: U64 ) ) ,
89
+ ty:: UintTy :: U128 => TyKind :: RigidTy ( RigidTy :: Uint ( UintTy :: U128 ) ) ,
90
+ } ,
91
+ ty:: Float ( float_ty) => match float_ty {
92
+ ty:: FloatTy :: F32 => TyKind :: RigidTy ( RigidTy :: Float ( FloatTy :: F32 ) ) ,
93
+ ty:: FloatTy :: F64 => TyKind :: RigidTy ( RigidTy :: Float ( FloatTy :: F64 ) ) ,
94
+ } ,
77
95
ty:: Adt ( _, _) => todo ! ( ) ,
78
96
ty:: Foreign ( _) => todo ! ( ) ,
79
97
ty:: Str => todo ! ( ) ,
@@ -90,9 +108,9 @@ impl<'tcx> Tables<'tcx> {
90
108
ty:: GeneratorWitness ( _) => todo ! ( ) ,
91
109
ty:: GeneratorWitnessMIR ( _, _) => todo ! ( ) ,
92
110
ty:: Never => todo ! ( ) ,
93
- ty:: Tuple ( fields) => {
94
- TyKind :: Tuple ( fields. iter ( ) . map ( |ty| self . intern_ty ( ty) ) . collect ( ) )
95
- }
111
+ ty:: Tuple ( fields) => TyKind :: RigidTy ( RigidTy :: Tuple (
112
+ fields. iter ( ) . map ( |ty| self . intern_ty ( ty) ) . collect ( ) ,
113
+ ) ) ,
96
114
ty:: Alias ( _, _) => todo ! ( ) ,
97
115
ty:: Param ( _) => todo ! ( ) ,
98
116
ty:: Bound ( _, _) => todo ! ( ) ,
0 commit comments