@@ -26,16 +26,13 @@ use middle::trans::type_of;
26
26
use middle:: trans:: type_use;
27
27
use middle:: trans:: intrinsic;
28
28
use middle:: ty;
29
- use middle:: ty:: { FnSig } ;
30
29
use middle:: typeck;
31
30
use util:: ppaux:: { Repr , ty_to_str} ;
32
31
33
32
use syntax:: ast;
34
33
use syntax:: ast_map;
35
34
use syntax:: ast_map:: path_name;
36
35
use syntax:: ast_util:: local_def;
37
- use syntax:: opt_vec;
38
- use syntax:: abi:: AbiSet ;
39
36
40
37
pub fn monomorphic_fn ( ccx : @mut CrateContext ,
41
38
fn_id : ast:: def_id ,
@@ -61,17 +58,10 @@ pub fn monomorphic_fn(ccx: @mut CrateContext,
61
58
let _icx = push_ctxt ( "monomorphic_fn" ) ;
62
59
let mut must_cast = false ;
63
60
64
- let do_normalize = |t : & ty:: t | {
65
- match normalize_for_monomorphization ( ccx. tcx , * t) {
66
- Some ( t) => { must_cast = true ; t }
67
- None => * t
68
- }
69
- } ;
70
-
71
61
let psubsts = @param_substs {
72
- tys : real_substs. tps . map ( |x| do_normalize ( x ) ) ,
62
+ tys : real_substs. tps . to_owned ( ) ,
73
63
vtables : vtables,
74
- self_ty : real_substs. self_ty . map ( |x| do_normalize ( x ) ) ,
64
+ self_ty : real_substs. self_ty . clone ( ) ,
75
65
self_vtables : self_vtables
76
66
} ;
77
67
@@ -305,61 +295,6 @@ pub fn monomorphic_fn(ccx: @mut CrateContext,
305
295
( lldecl, must_cast)
306
296
}
307
297
308
- pub fn normalize_for_monomorphization ( tcx : ty:: ctxt ,
309
- ty : ty:: t ) -> Option < ty:: t > {
310
- // FIXME[mono] could do this recursively. is that worthwhile? (#2529)
311
- return match ty:: get ( ty) . sty {
312
- ty:: ty_box( * ) => {
313
- Some ( ty:: mk_opaque_box ( tcx) )
314
- }
315
- ty:: ty_bare_fn( _) => {
316
- Some ( ty:: mk_bare_fn (
317
- tcx,
318
- ty:: BareFnTy {
319
- purity : ast:: impure_fn,
320
- abis : AbiSet :: Rust ( ) ,
321
- sig : FnSig { bound_lifetime_names : opt_vec:: Empty ,
322
- inputs : ~[ ] ,
323
- output : ty:: mk_nil ( ) } } ) )
324
- }
325
- ty:: ty_closure( ref fty) => {
326
- Some ( normalized_closure_ty ( tcx, fty. sigil ) )
327
- }
328
- ty:: ty_trait( _, _, ref store, _, _) => {
329
- let sigil = match * store {
330
- ty:: UniqTraitStore => ast:: OwnedSigil ,
331
- ty:: BoxTraitStore => ast:: ManagedSigil ,
332
- ty:: RegionTraitStore ( _) => ast:: BorrowedSigil ,
333
- } ;
334
-
335
- // Traits have the same runtime representation as closures.
336
- Some ( normalized_closure_ty ( tcx, sigil) )
337
- }
338
- ty:: ty_ptr( _) => {
339
- Some ( ty:: mk_uint ( ) )
340
- }
341
- _ => {
342
- None
343
- }
344
- } ;
345
-
346
- fn normalized_closure_ty ( tcx : ty:: ctxt ,
347
- sigil : ast:: Sigil ) -> ty:: t
348
- {
349
- ty:: mk_closure (
350
- tcx,
351
- ty:: ClosureTy {
352
- purity : ast:: impure_fn,
353
- sigil : sigil,
354
- onceness : ast:: Many ,
355
- region : ty:: re_static,
356
- bounds : ty:: EmptyBuiltinBounds ( ) ,
357
- sig : ty:: FnSig { bound_lifetime_names : opt_vec:: Empty ,
358
- inputs : ~[ ] ,
359
- output : ty:: mk_nil ( ) } } )
360
- }
361
- }
362
-
363
298
pub fn make_mono_id ( ccx : @mut CrateContext ,
364
299
item : ast:: def_id ,
365
300
substs : & param_substs ,
0 commit comments