@@ -254,6 +254,7 @@ impl<'a> CFGBuilder<'a> {
254
254
} ) ;
255
255
let body_exit = self . block ( & * * body, cond_exit) ; // 4
256
256
self . add_contained_edge ( body_exit, loopback) ; // 5
257
+ self . loop_scopes . pop ( ) ;
257
258
expr_exit
258
259
}
259
260
@@ -427,8 +428,22 @@ impl<'a> CFGBuilder<'a> {
427
428
self . straightline ( expr, pred, [ e] )
428
429
}
429
430
431
+ ast:: ExprInlineAsm ( ref inline_asm) => {
432
+ let inputs = inline_asm. inputs . iter ( ) ;
433
+ let outputs = inline_asm. outputs . iter ( ) ;
434
+ fn extract_expr < A > ( & ( _, expr) : & ( A , Gc < ast:: Expr > ) ) -> Gc < ast:: Expr > { expr }
435
+ let post_inputs = self . exprs ( inputs. map ( |a| {
436
+ debug ! ( "cfg::construct InlineAsm id:{} input:{:?}" , expr. id, a) ;
437
+ extract_expr ( a)
438
+ } ) , pred) ;
439
+ let post_outputs = self . exprs ( outputs. map ( |a| {
440
+ debug ! ( "cfg::construct InlineAsm id:{} output:{:?}" , expr. id, a) ;
441
+ extract_expr ( a)
442
+ } ) , post_inputs) ;
443
+ self . add_node ( expr. id , [ post_outputs] )
444
+ }
445
+
430
446
ast:: ExprMac ( ..) |
431
- ast:: ExprInlineAsm ( ..) |
432
447
ast:: ExprFnBlock ( ..) |
433
448
ast:: ExprProc ( ..) |
434
449
ast:: ExprLit ( ..) |
@@ -444,15 +459,22 @@ impl<'a> CFGBuilder<'a> {
444
459
func_or_rcvr : Gc < ast:: Expr > ,
445
460
args : & [ Gc < ast:: Expr > ] ) -> CFGIndex {
446
461
let func_or_rcvr_exit = self . expr ( func_or_rcvr, pred) ;
447
- self . straightline ( call_expr, func_or_rcvr_exit, args)
462
+ let ret = self . straightline ( call_expr, func_or_rcvr_exit, args) ;
463
+
464
+ let return_ty = ty:: node_id_to_type ( self . tcx , call_expr. id ) ;
465
+ let fails = ty:: type_is_bot ( return_ty) ;
466
+ if fails {
467
+ self . add_node ( ast:: DUMMY_NODE_ID , [ ] )
468
+ } else {
469
+ ret
470
+ }
448
471
}
449
472
450
- fn exprs ( & mut self ,
451
- exprs : & [ Gc < ast :: Expr > ] ,
452
- pred : CFGIndex ) -> CFGIndex {
473
+ fn exprs < I : Iterator < Gc < ast :: Expr > > > ( & mut self ,
474
+ mut exprs : I ,
475
+ pred : CFGIndex ) -> CFGIndex {
453
476
//! Constructs graph for `exprs` evaluated in order
454
-
455
- exprs. iter ( ) . fold ( pred, |p, & e| self . expr ( e, p) )
477
+ exprs. fold ( pred, |p, e| self . expr ( e, p) )
456
478
}
457
479
458
480
fn opt_expr ( & mut self ,
@@ -469,7 +491,7 @@ impl<'a> CFGBuilder<'a> {
469
491
subexprs : & [ Gc < ast:: Expr > ] ) -> CFGIndex {
470
492
//! Handles case of an expression that evaluates `subexprs` in order
471
493
472
- let subexprs_exit = self . exprs ( subexprs, pred) ;
494
+ let subexprs_exit = self . exprs ( subexprs. iter ( ) . map ( | & e|e ) , pred) ;
473
495
self . add_node ( expr. id , [ subexprs_exit] )
474
496
}
475
497
0 commit comments