@@ -49,7 +49,6 @@ pub fn monomorphic_fn(ccx: &CrateContext,
49
49
50
50
assert ! ( real_substs. tps. iter( ) . all( |t| !ty:: type_needs_infer( * t) ) ) ;
51
51
let _icx = push_ctxt ( "monomorphic_fn" ) ;
52
- let mut must_cast = false ;
53
52
54
53
let psubsts = @param_substs {
55
54
tys : real_substs. tps . clone ( ) ,
@@ -62,10 +61,6 @@ pub fn monomorphic_fn(ccx: &CrateContext,
62
61
for s in psubsts. tys . iter ( ) { assert ! ( !ty:: type_has_params( * s) ) ; }
63
62
64
63
let hash_id = make_mono_id ( ccx, fn_id, & * psubsts) ;
65
- if hash_id. params . iter ( ) . any (
66
- |p| match * p { mono_precise( _, _) => false , _ => true } ) {
67
- must_cast = true ;
68
- }
69
64
70
65
debug ! ( "monomorphic_fn(\
71
66
fn_id={}, \
@@ -79,7 +74,7 @@ pub fn monomorphic_fn(ccx: &CrateContext,
79
74
Some ( & val) => {
80
75
debug ! ( "leaving monomorphic fn {}" ,
81
76
ty:: item_path_str( ccx. tcx( ) , fn_id) ) ;
82
- return ( val, must_cast ) ;
77
+ return ( val, false ) ;
83
78
}
84
79
None => ( )
85
80
}
@@ -286,32 +281,31 @@ pub fn monomorphic_fn(ccx: &CrateContext,
286
281
ccx. monomorphizing . borrow_mut ( ) . insert ( fn_id, depth) ;
287
282
288
283
debug ! ( "leaving monomorphic fn {}" , ty:: item_path_str( ccx. tcx( ) , fn_id) ) ;
289
- ( lldecl, must_cast )
284
+ ( lldecl, false )
290
285
}
291
286
292
287
pub fn make_mono_id ( ccx : & CrateContext ,
293
288
item : ast:: DefId ,
294
289
substs : & param_substs ) -> mono_id {
295
- // FIXME (possibly #5801): Need a lot of type hints to get
296
- // .collect() to work.
297
290
let substs_iter = substs. self_ty . iter ( ) . chain ( substs. tys . iter ( ) ) ;
298
- let precise_param_ids: Vec < ( ty:: t , Option < @Vec < mono_id > > ) > = match substs. vtables {
299
- Some ( ref vts) => {
300
- debug ! ( "make_mono_id vtables={} substs={}" ,
301
- vts. repr( ccx. tcx( ) ) , substs. tys. repr( ccx. tcx( ) ) ) ;
302
- let vts_iter = substs. self_vtables . iter ( ) . chain ( vts. iter ( ) ) ;
303
- vts_iter. zip ( substs_iter) . map ( |( vtable, subst) | {
304
- let v = vtable. iter ( ) . map ( |vt| meth:: vtable_id ( ccx, vt) ) . collect :: < Vec < _ > > ( ) ;
305
- ( * subst, if !v. is_empty ( ) { Some ( @v) } else { None } )
291
+ let param_ids: Vec < MonoParamId > = match substs. vtables {
292
+ Some ( ref vts) => {
293
+ debug ! ( "make_mono_id vtables={} substs={}" ,
294
+ vts. repr( ccx. tcx( ) ) , substs. tys. repr( ccx. tcx( ) ) ) ;
295
+ let vts_iter = substs. self_vtables . iter ( ) . chain ( vts. iter ( ) ) ;
296
+ vts_iter. zip ( substs_iter) . map ( |( vtable, subst) | MonoParamId {
297
+ subst : * subst,
298
+ vtables : vtable. iter ( ) . map ( |vt| meth:: vtable_id ( ccx, vt) ) . collect ( )
299
+ } ) . collect ( )
300
+ }
301
+ None => substs_iter. map ( |subst| MonoParamId {
302
+ subst : * subst,
303
+ vtables : Vec :: new ( )
306
304
} ) . collect ( )
307
- }
308
- None => substs_iter. map ( |subst| ( * subst, None :: < @Vec < mono_id > > ) ) . collect ( )
309
305
} ;
310
306
311
-
312
- let param_ids = precise_param_ids. iter ( ) . map ( |x| {
313
- let ( a, b) = * x;
314
- mono_precise ( a, b)
315
- } ) . collect ( ) ;
316
- @mono_id_ { def : item, params : param_ids}
307
+ @mono_id_ {
308
+ def : item,
309
+ params : param_ids
310
+ }
317
311
}
0 commit comments