@@ -347,7 +347,7 @@ fn load_environment(fcx: fn_ctxt,
347
347
}
348
348
349
349
fn trans_expr_fn ( bcx : block ,
350
- proto : ast :: proto ,
350
+ proto : ty :: fn_proto ,
351
351
decl : ast:: fn_decl ,
352
352
body : ast:: blk ,
353
353
id : ast:: node_id ,
@@ -364,8 +364,8 @@ fn trans_expr_fn(bcx: block,
364
364
let llfn = decl_internal_cdecl_fn ( ccx. llmod , s, llfnty) ;
365
365
366
366
let trans_closure_env = fn @( ck: ty:: closure_kind) -> result {
367
- let cap_vars = capture:: compute_capture_vars (
368
- ccx . tcx , id , proto , cap_clause) ;
367
+ let cap_vars = capture:: compute_capture_vars ( ccx . tcx , id , proto ,
368
+ cap_clause) ;
369
369
let ret_handle = match is_loop_body { some( x) => x, none => none } ;
370
370
let { llbox, cdata_ty, bcx} = build_closure ( bcx, cap_vars, ck, id,
371
371
ret_handle) ;
@@ -382,14 +382,19 @@ fn trans_expr_fn(bcx: block,
382
382
} ;
383
383
384
384
let { bcx: bcx , val : closure } = match proto {
385
- ast:: proto_block => trans_closure_env ( ty:: ck_block) ,
386
- ast:: proto_box => trans_closure_env ( ty:: ck_box) ,
387
- ast:: proto_uniq => trans_closure_env ( ty:: ck_uniq) ,
388
- ast:: proto_bare => {
385
+ ty:: proto_vstore( ty:: vstore_slice( _) ) =>
386
+ trans_closure_env ( ty:: ck_block) ,
387
+ ty:: proto_vstore( ty:: vstore_box) =>
388
+ trans_closure_env ( ty:: ck_box) ,
389
+ ty:: proto_vstore( ty:: vstore_uniq) =>
390
+ trans_closure_env ( ty:: ck_uniq) ,
391
+ ty:: proto_bare => {
389
392
trans_closure ( ccx, sub_path, decl, body, llfn, no_self, none,
390
393
id, |_fcx| { } , |_bcx| { } ) ;
391
394
{ bcx: bcx, val: C_null ( T_opaque_box_ptr ( ccx) ) }
392
395
}
396
+ ty:: proto_vstore( ty:: vstore_fixed( _) ) =>
397
+ fail ~"vstore_fixed unexpected"
393
398
} ;
394
399
fill_fn_pair ( bcx, get_dest_addr ( dest) , llfn, closure) ;
395
400
@@ -416,11 +421,15 @@ fn make_fn_glue(
416
421
} ;
417
422
418
423
return match ty:: get ( t) . struct {
419
- ty:: ty_fn( { proto: ast:: proto_bare, _} ) |
420
- ty:: ty_fn( { proto: ast:: proto_block, _} ) => bcx,
421
- ty:: ty_fn( { proto: ast:: proto_uniq, _} ) => fn_env ( ty:: ck_uniq) ,
422
- ty:: ty_fn( { proto: ast:: proto_box, _} ) => fn_env ( ty:: ck_box) ,
423
- _ => fail ~"make_fn_glue invoked on non-function type"
424
+ ty:: ty_fn( { proto: ty:: proto_bare, _} ) |
425
+ ty:: ty_fn( { proto: ty:: proto_vstore( ty:: vstore_slice( _) ) , _} ) =>
426
+ bcx,
427
+ ty:: ty_fn( { proto: ty:: proto_vstore( ty:: vstore_uniq) , _} ) =>
428
+ fn_env ( ty:: ck_uniq) ,
429
+ ty:: ty_fn( { proto: ty:: proto_vstore( ty:: vstore_box) , _} ) =>
430
+ fn_env ( ty:: ck_box) ,
431
+ _ =>
432
+ fail ~"make_fn_glue invoked on non-function type"
424
433
} ;
425
434
}
426
435
0 commit comments