|
8 | 8 | //! For now, we are developing everything inside `rustc`, thus, we keep this module private.
|
9 | 9 |
|
10 | 10 | use crate::rustc_internal::{self, opaque};
|
11 |
| -use crate::stable_mir::ty::{FloatTy, IntTy, RigidTy, TyKind, UintTy}; |
| 11 | +use crate::stable_mir::ty::{AdtSubsts, FloatTy, GenericArgKind, IntTy, RigidTy, TyKind, UintTy}; |
12 | 12 | use crate::stable_mir::{self, Context};
|
13 | 13 | use rustc_middle::mir;
|
14 | 14 | use rustc_middle::ty::{self, Ty, TyCtxt};
|
@@ -94,7 +94,25 @@ impl<'tcx> Tables<'tcx> {
|
94 | 94 | ty::FloatTy::F32 => TyKind::RigidTy(RigidTy::Float(FloatTy::F32)),
|
95 | 95 | ty::FloatTy::F64 => TyKind::RigidTy(RigidTy::Float(FloatTy::F64)),
|
96 | 96 | },
|
97 |
| - ty::Adt(_, _) => todo!(), |
| 97 | + ty::Adt(adt_def, substs) => TyKind::RigidTy(RigidTy::Adt( |
| 98 | + rustc_internal::adt_def(adt_def.did()), |
| 99 | + AdtSubsts( |
| 100 | + substs |
| 101 | + .iter() |
| 102 | + .map(|arg| match arg.unpack() { |
| 103 | + ty::GenericArgKind::Lifetime(region) => { |
| 104 | + GenericArgKind::Lifetime(opaque(®ion)) |
| 105 | + } |
| 106 | + ty::GenericArgKind::Type(ty) => { |
| 107 | + GenericArgKind::Type(self.intern_ty(ty)) |
| 108 | + } |
| 109 | + ty::GenericArgKind::Const(const_) => { |
| 110 | + GenericArgKind::Const(opaque(&const_)) |
| 111 | + } |
| 112 | + }) |
| 113 | + .collect(), |
| 114 | + ), |
| 115 | + )), |
98 | 116 | ty::Foreign(_) => todo!(),
|
99 | 117 | ty::Str => todo!(),
|
100 | 118 | ty::Array(_, _) => todo!(),
|
|
0 commit comments