@@ -150,26 +150,6 @@ pub fn type_of_rust_fn<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
150
150
Type :: func ( & atys[ ..] , & lloutputtype)
151
151
}
152
152
153
- // Given a function type and a count of ty params, construct an llvm type
154
- pub fn type_of_fn_from_ty < ' a , ' tcx > ( cx : & CrateContext < ' a , ' tcx > , fty : Ty < ' tcx > ) -> Type {
155
- match fty. sty {
156
- ty:: TyFnDef ( _, _, ref f) | ty:: TyFnPtr ( ref f) => {
157
- // FIXME(#19925) once fn item types are
158
- // zero-sized, we'll need to do something here
159
- if f. abi == Abi :: Rust || f. abi == Abi :: RustCall {
160
- let sig = cx. tcx ( ) . erase_late_bound_regions ( & f. sig ) ;
161
- let sig = infer:: normalize_associated_type ( cx. tcx ( ) , & sig) ;
162
- type_of_rust_fn ( cx, None , & sig, f. abi )
163
- } else {
164
- foreign:: lltype_for_foreign_fn ( cx, fty)
165
- }
166
- }
167
- _ => {
168
- cx. sess ( ) . bug ( "type_of_fn_from_ty given non-closure, non-bare-fn" )
169
- }
170
- }
171
- }
172
-
173
153
// A "sizing type" is an LLVM type, the size and alignment of which are
174
154
// guaranteed to be equivalent to what you would get out of `type_of()`. It's
175
155
// useful because:
@@ -415,8 +395,16 @@ pub fn in_memory_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) ->
415
395
ty:: TySlice ( ty) => in_memory_type_of ( cx, ty) ,
416
396
ty:: TyStr | ty:: TyTrait ( ..) => Type :: i8 ( cx) ,
417
397
418
- ty:: TyFnDef ( ..) | ty:: TyFnPtr ( _) => {
419
- type_of_fn_from_ty ( cx, t) . ptr_to ( )
398
+ ty:: TyFnDef ( _, _, ref f) | ty:: TyFnPtr ( ref f) => {
399
+ // FIXME(#19925) once fn item types are
400
+ // zero-sized, we'll need to do something here
401
+ if f. abi == Abi :: Rust || f. abi == Abi :: RustCall {
402
+ let sig = cx. tcx ( ) . erase_late_bound_regions ( & f. sig ) ;
403
+ let sig = infer:: normalize_associated_type ( cx. tcx ( ) , & sig) ;
404
+ type_of_rust_fn ( cx, None , & sig, f. abi ) . ptr_to ( )
405
+ } else {
406
+ foreign:: lltype_for_foreign_fn ( cx, t) . ptr_to ( )
407
+ }
420
408
}
421
409
ty:: TyTuple ( ref tys) if tys. is_empty ( ) => Type :: nil ( cx) ,
422
410
ty:: TyTuple ( ..) => {
0 commit comments