@@ -73,19 +73,19 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
73
73
74
74
let expr_exit = self . opt_expr ( & blk. expr , stmts_exit) ;
75
75
76
- self . add_node ( blk. id , [ expr_exit] )
76
+ self . add_node ( blk. id , & [ expr_exit] )
77
77
}
78
78
79
79
fn stmt ( & mut self , stmt : & ast:: Stmt , pred : CFGIndex ) -> CFGIndex {
80
80
match stmt. node {
81
81
ast:: StmtDecl ( ref decl, id) => {
82
82
let exit = self . decl ( & * * decl, pred) ;
83
- self . add_node ( id, [ exit] )
83
+ self . add_node ( id, & [ exit] )
84
84
}
85
85
86
86
ast:: StmtExpr ( ref expr, id) | ast:: StmtSemi ( ref expr, id) => {
87
87
let exit = self . expr ( & * * expr, pred) ;
88
- self . add_node ( id, [ exit] )
88
+ self . add_node ( id, & [ exit] )
89
89
}
90
90
91
91
ast:: StmtMac ( ..) => {
@@ -114,33 +114,33 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
114
114
ast:: PatLit ( ..) |
115
115
ast:: PatRange ( ..) |
116
116
ast:: PatWild ( _) => {
117
- self . add_node ( pat. id , [ pred] )
117
+ self . add_node ( pat. id , & [ pred] )
118
118
}
119
119
120
120
ast:: PatBox ( ref subpat) |
121
121
ast:: PatRegion ( ref subpat) |
122
122
ast:: PatIdent ( _, _, Some ( ref subpat) ) => {
123
123
let subpat_exit = self . pat ( & * * subpat, pred) ;
124
- self . add_node ( pat. id , [ subpat_exit] )
124
+ self . add_node ( pat. id , & [ subpat_exit] )
125
125
}
126
126
127
127
ast:: PatEnum ( _, Some ( ref subpats) ) |
128
128
ast:: PatTup ( ref subpats) => {
129
129
let pats_exit = self . pats_all ( subpats. iter ( ) , pred) ;
130
- self . add_node ( pat. id , [ pats_exit] )
130
+ self . add_node ( pat. id , & [ pats_exit] )
131
131
}
132
132
133
133
ast:: PatStruct ( _, ref subpats, _) => {
134
134
let pats_exit =
135
135
self . pats_all ( subpats. iter ( ) . map ( |f| & f. node . pat ) , pred) ;
136
- self . add_node ( pat. id , [ pats_exit] )
136
+ self . add_node ( pat. id , & [ pats_exit] )
137
137
}
138
138
139
139
ast:: PatVec ( ref pre, ref vec, ref post) => {
140
140
let pre_exit = self . pats_all ( pre. iter ( ) , pred) ;
141
141
let vec_exit = self . pats_all ( vec. iter ( ) , pre_exit) ;
142
142
let post_exit = self . pats_all ( post. iter ( ) , vec_exit) ;
143
- self . add_node ( pat. id , [ post_exit] )
143
+ self . add_node ( pat. id , & [ post_exit] )
144
144
}
145
145
146
146
ast:: PatMac ( _) => {
@@ -165,7 +165,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
165
165
if pats. len ( ) == 1 {
166
166
self . pat ( & * pats[ 0 ] , pred)
167
167
} else {
168
- let collect = self . add_dummy_node ( [ ] ) ;
168
+ let collect = self . add_dummy_node ( & [ ] ) ;
169
169
for pat in pats. iter ( ) {
170
170
let pat_exit = self . pat ( & * * pat, pred) ;
171
171
self . add_contained_edge ( pat_exit, collect) ;
@@ -178,7 +178,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
178
178
match expr. node {
179
179
ast:: ExprBlock ( ref blk) => {
180
180
let blk_exit = self . block ( & * * blk, pred) ;
181
- self . add_node ( expr. id , [ blk_exit] )
181
+ self . add_node ( expr. id , & [ blk_exit] )
182
182
}
183
183
184
184
ast:: ExprIf ( ref cond, ref then, None ) => {
@@ -198,7 +198,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
198
198
//
199
199
let cond_exit = self . expr ( & * * cond, pred) ; // 1
200
200
let then_exit = self . block ( & * * then, cond_exit) ; // 2
201
- self . add_node ( expr. id , [ cond_exit, then_exit] ) // 3,4
201
+ self . add_node ( expr. id , & [ cond_exit, then_exit] ) // 3,4
202
202
}
203
203
204
204
ast:: ExprIf ( ref cond, ref then, Some ( ref otherwise) ) => {
@@ -219,7 +219,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
219
219
let cond_exit = self . expr ( & * * cond, pred) ; // 1
220
220
let then_exit = self . block ( & * * then, cond_exit) ; // 2
221
221
let else_exit = self . expr ( & * * otherwise, cond_exit) ; // 3
222
- self . add_node ( expr. id , [ then_exit, else_exit] ) // 4, 5
222
+ self . add_node ( expr. id , & [ then_exit, else_exit] ) // 4, 5
223
223
}
224
224
225
225
ast:: ExprIfLet ( ..) => {
@@ -245,9 +245,9 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
245
245
// may cause additional edges.
246
246
247
247
// Is the condition considered part of the loop?
248
- let loopback = self . add_dummy_node ( [ pred] ) ; // 1
249
- let cond_exit = self . expr ( & * * cond, loopback) ; // 2
250
- let expr_exit = self . add_node ( expr. id , [ cond_exit] ) ; // 3
248
+ let loopback = self . add_dummy_node ( & [ pred] ) ; // 1
249
+ let cond_exit = self . expr ( & * * cond, loopback) ; // 2
250
+ let expr_exit = self . add_node ( expr. id , & [ cond_exit] ) ; // 3
251
251
self . loop_scopes . push ( LoopScope {
252
252
loop_id : expr. id ,
253
253
continue_index : loopback,
@@ -286,10 +286,10 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
286
286
// Note that `break` and `continue` statements
287
287
// may cause additional edges.
288
288
289
- let head = self . expr ( & * * head, pred) ; // 1
290
- let loopback = self . add_dummy_node ( [ head] ) ; // 2
291
- let cond = self . add_dummy_node ( [ loopback] ) ; // 3
292
- let expr_exit = self . add_node ( expr. id , [ cond] ) ; // 4
289
+ let head = self . expr ( & * * head, pred) ; // 1
290
+ let loopback = self . add_dummy_node ( & [ head] ) ; // 2
291
+ let cond = self . add_dummy_node ( & [ loopback] ) ; // 3
292
+ let expr_exit = self . add_node ( expr. id , & [ cond] ) ; // 4
293
293
self . loop_scopes . push ( LoopScope {
294
294
loop_id : expr. id ,
295
295
continue_index : loopback,
@@ -317,8 +317,8 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
317
317
// Note that `break` and `loop` statements
318
318
// may cause additional edges.
319
319
320
- let loopback = self . add_dummy_node ( [ pred] ) ; // 1
321
- let expr_exit = self . add_node ( expr. id , [ ] ) ; // 2
320
+ let loopback = self . add_dummy_node ( & [ pred] ) ; // 1
321
+ let expr_exit = self . add_node ( expr. id , & [ ] ) ; // 2
322
322
self . loop_scopes . push ( LoopScope {
323
323
loop_id : expr. id ,
324
324
continue_index : loopback,
@@ -358,10 +358,10 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
358
358
//
359
359
let discr_exit = self . expr ( & * * discr, pred) ; // 1
360
360
361
- let expr_exit = self . add_node ( expr. id , [ ] ) ;
361
+ let expr_exit = self . add_node ( expr. id , & [ ] ) ;
362
362
let mut cond_exit = discr_exit;
363
363
for arm in arms. iter ( ) {
364
- cond_exit = self . add_dummy_node ( [ cond_exit] ) ; // 2
364
+ cond_exit = self . add_dummy_node ( & [ cond_exit] ) ; // 2
365
365
let pats_exit = self . pats_any ( arm. pats . as_slice ( ) ,
366
366
cond_exit) ; // 3
367
367
let guard_exit = self . opt_expr ( & arm. guard ,
@@ -389,30 +389,30 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
389
389
//
390
390
let l_exit = self . expr ( & * * l, pred) ; // 1
391
391
let r_exit = self . expr ( & * * r, l_exit) ; // 2
392
- self . add_node ( expr. id , [ l_exit, r_exit] ) // 3,4
392
+ self . add_node ( expr. id , & [ l_exit, r_exit] ) // 3,4
393
393
}
394
394
395
395
ast:: ExprRet ( ref v) => {
396
396
let v_exit = self . opt_expr ( v, pred) ;
397
- let b = self . add_node ( expr. id , [ v_exit] ) ;
397
+ let b = self . add_node ( expr. id , & [ v_exit] ) ;
398
398
self . add_returning_edge ( expr, b) ;
399
- self . add_node ( ast:: DUMMY_NODE_ID , [ ] )
399
+ self . add_node ( ast:: DUMMY_NODE_ID , & [ ] )
400
400
}
401
401
402
402
ast:: ExprBreak ( label) => {
403
403
let loop_scope = self . find_scope ( expr, label) ;
404
- let b = self . add_node ( expr. id , [ pred] ) ;
404
+ let b = self . add_node ( expr. id , & [ pred] ) ;
405
405
self . add_exiting_edge ( expr, b,
406
406
loop_scope, loop_scope. break_index ) ;
407
- self . add_node ( ast:: DUMMY_NODE_ID , [ ] )
407
+ self . add_node ( ast:: DUMMY_NODE_ID , & [ ] )
408
408
}
409
409
410
410
ast:: ExprAgain ( label) => {
411
411
let loop_scope = self . find_scope ( expr, label) ;
412
- let a = self . add_node ( expr. id , [ pred] ) ;
412
+ let a = self . add_node ( expr. id , & [ pred] ) ;
413
413
self . add_exiting_edge ( expr, a,
414
414
loop_scope, loop_scope. continue_index ) ;
415
- self . add_node ( ast:: DUMMY_NODE_ID , [ ] )
415
+ self . add_node ( ast:: DUMMY_NODE_ID , & [ ] )
416
416
}
417
417
418
418
ast:: ExprVec ( ref elems) => {
@@ -492,7 +492,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
492
492
let & ( _, ref expr, _) = a;
493
493
& * * expr
494
494
} ) , post_inputs) ;
495
- self . add_node ( expr. id , [ post_outputs] )
495
+ self . add_node ( expr. id , & [ post_outputs] )
496
496
}
497
497
498
498
ast:: ExprMac ( ..) |
@@ -520,7 +520,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
520
520
let func_or_rcvr_exit = self . expr ( func_or_rcvr, pred) ;
521
521
let ret = self . straightline ( call_expr, func_or_rcvr_exit, args) ;
522
522
if return_ty == ty:: FnDiverging {
523
- self . add_node ( ast:: DUMMY_NODE_ID , [ ] )
523
+ self . add_node ( ast:: DUMMY_NODE_ID , & [ ] )
524
524
} else {
525
525
ret
526
526
}
@@ -547,7 +547,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
547
547
//! Handles case of an expression that evaluates `subexprs` in order
548
548
549
549
let subexprs_exit = self . exprs ( subexprs, pred) ;
550
- self . add_node ( expr. id , [ subexprs_exit] )
550
+ self . add_node ( expr. id , & [ subexprs_exit] )
551
551
}
552
552
553
553
fn add_dummy_node ( & mut self , preds : & [ CFGIndex ] ) -> CFGIndex {
0 commit comments