|
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, GenericArgs, GenericArgKind, IntTy, RigidTy, TyKind, UintTy}; |
| 11 | +use crate::stable_mir::ty::{FloatTy, GenericArgKind, GenericArgs, 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};
|
@@ -127,7 +127,25 @@ impl<'tcx> Tables<'tcx> {
|
127 | 127 | ty::Ref(region, ty, mutbl) => {
|
128 | 128 | TyKind::RigidTy(RigidTy::Ref(opaque(region), self.intern_ty(*ty), mutbl.stable()))
|
129 | 129 | }
|
130 |
| - ty::FnDef(_, _) => todo!(), |
| 130 | + ty::FnDef(def_id, generic_args) => TyKind::RigidTy(RigidTy::FnDef( |
| 131 | + rustc_internal::fn_def(*def_id), |
| 132 | + GenericArgs( |
| 133 | + generic_args |
| 134 | + .iter() |
| 135 | + .map(|arg| match arg.unpack() { |
| 136 | + ty::GenericArgKind::Lifetime(region) => { |
| 137 | + GenericArgKind::Lifetime(opaque(®ion)) |
| 138 | + } |
| 139 | + ty::GenericArgKind::Type(ty) => { |
| 140 | + GenericArgKind::Type(self.intern_ty(ty)) |
| 141 | + } |
| 142 | + ty::GenericArgKind::Const(const_) => { |
| 143 | + GenericArgKind::Const(opaque(&const_)) |
| 144 | + } |
| 145 | + }) |
| 146 | + .collect(), |
| 147 | + ), |
| 148 | + )), |
131 | 149 | ty::FnPtr(_) => todo!(),
|
132 | 150 | ty::Dynamic(_, _, _) => todo!(),
|
133 | 151 | ty::Closure(_, _) => todo!(),
|
|
0 commit comments