@@ -350,43 +350,6 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
350
350
}
351
351
}
352
352
353
- // For `try` we need some custom control flow
354
- if & name[ ..] == "try" {
355
- if let callee:: ArgExprs ( ref exprs) = args {
356
- let ( func, data, local_ptr) = if exprs. len ( ) != 3 {
357
- ccx. sess ( ) . bug ( "expected three exprs as arguments for \
358
- `try` intrinsic") ;
359
- } else {
360
- ( & exprs[ 0 ] , & exprs[ 1 ] , & exprs[ 2 ] )
361
- } ;
362
-
363
- // translate arguments
364
- let func = unpack_datum ! ( bcx, expr:: trans( bcx, func) ) ;
365
- let func = unpack_datum ! ( bcx, func. to_rvalue_datum( bcx, "func" ) ) ;
366
- let data = unpack_datum ! ( bcx, expr:: trans( bcx, data) ) ;
367
- let data = unpack_datum ! ( bcx, data. to_rvalue_datum( bcx, "data" ) ) ;
368
- let local_ptr = unpack_datum ! ( bcx, expr:: trans( bcx, local_ptr) ) ;
369
- let local_ptr = local_ptr. to_rvalue_datum ( bcx, "local_ptr" ) ;
370
- let local_ptr = unpack_datum ! ( bcx, local_ptr) ;
371
-
372
- let dest = match dest {
373
- expr:: SaveIn ( d) => d,
374
- expr:: Ignore => alloc_ty ( bcx, tcx. mk_mut_ptr ( tcx. types . i8 ) ,
375
- "try_result" ) ,
376
- } ;
377
-
378
- // do the invoke
379
- bcx = try_intrinsic ( bcx, func. val , data. val , local_ptr. val , dest,
380
- call_debug_location) ;
381
-
382
- fcx. pop_and_trans_custom_cleanup_scope ( bcx, cleanup_scope) ;
383
- return Result :: new ( bcx, dest) ;
384
- } else {
385
- ccx. sess ( ) . bug ( "expected two exprs as arguments for \
386
- `try` intrinsic") ;
387
- }
388
- }
389
-
390
353
// save the actual AST arguments for later (some places need to do
391
354
// const-evaluation on them)
392
355
let expr_arguments = match args {
@@ -446,6 +409,11 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
446
409
( Some ( llfn) , _) => {
447
410
Call ( bcx, llfn, & llargs, call_debug_location)
448
411
}
412
+ ( _, "try" ) => {
413
+ bcx = try_intrinsic ( bcx, llargs[ 0 ] , llargs[ 1 ] , llargs[ 2 ] , llresult,
414
+ call_debug_location) ;
415
+ C_nil ( ccx)
416
+ }
449
417
( _, "breakpoint" ) => {
450
418
let llfn = ccx. get_intrinsic ( & ( "llvm.debugtrap" ) ) ;
451
419
Call ( bcx, llfn, & [ ] , call_debug_location)
0 commit comments