@@ -24,13 +24,14 @@ use super::operand::OperandValue::{Pair, Ref, Immediate};
24
24
25
25
/// Used by `FunctionCx::codegen_terminator` for emitting common patterns
26
26
/// e.g., creating a basic block, calling a function, etc.
27
- struct TerminatorCodegenHelper < ' a , ' tcx > {
28
- bb : & ' a mir:: BasicBlock ,
29
- terminator : & ' a mir:: Terminator < ' tcx > ,
27
+ struct TerminatorCodegenHelper < ' tcx > {
28
+ bb : mir:: BasicBlock ,
29
+ terminator : & ' tcx mir:: Terminator < ' tcx > ,
30
30
funclet_bb : Option < mir:: BasicBlock > ,
31
31
}
32
32
33
- impl < ' a , ' tcx > TerminatorCodegenHelper < ' a , ' tcx > {
33
+ // FIXME(eddyb) clean up the lifetimes in this impl.
34
+ impl < ' tcx > TerminatorCodegenHelper < ' tcx > {
34
35
/// Returns the associated funclet from `FunctionCx::funclets` for the
35
36
/// `funclet_bb` member if it is not `None`.
36
37
fn funclet < ' c , ' b , Bx : BuilderMethods < ' b , ' tcx > > (
@@ -132,7 +133,7 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'a, 'tcx> {
132
133
} else {
133
134
let llret = bx. call ( fn_ptr, & llargs, self . funclet ( fx) ) ;
134
135
bx. apply_attrs_callsite ( & fn_abi, llret) ;
135
- if fx. mir [ * self . bb ] . is_cleanup {
136
+ if fx. mir [ self . bb ] . is_cleanup {
136
137
// Cleanup is always the cold path. Don't inline
137
138
// drop glue. Also, when there is a deeply-nested
138
139
// struct, there are "symmetry" issues that cause
@@ -151,15 +152,15 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'a, 'tcx> {
151
152
152
153
// Generate sideeffect intrinsic if jumping to any of the targets can form
153
154
// a loop.
154
- fn maybe_sideeffect < ' b , ' tcx2 : ' b , Bx : BuilderMethods < ' b , ' tcx2 > > (
155
+ fn maybe_sideeffect < ' b , Bx : BuilderMethods < ' b , ' tcx > > (
155
156
& self ,
156
- mir : & ' b mir:: Body < ' tcx > ,
157
+ mir : & ' tcx mir:: Body < ' tcx > ,
157
158
bx : & mut Bx ,
158
159
targets : & [ mir:: BasicBlock ] ,
159
160
) {
160
161
if bx. tcx ( ) . sess . opts . debugging_opts . insert_sideeffect {
161
- if targets. iter ( ) . any ( |target| {
162
- * target <= * self . bb
162
+ if targets. iter ( ) . any ( |& target| {
163
+ target <= self . bb
163
164
&& target
164
165
. start_location ( )
165
166
. is_predecessor_of ( self . bb . start_location ( ) , mir)
@@ -173,9 +174,9 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'a, 'tcx> {
173
174
/// Codegen implementations for some terminator variants.
174
175
impl < ' a , ' tcx , Bx : BuilderMethods < ' a , ' tcx > > FunctionCx < ' a , ' tcx , Bx > {
175
176
/// Generates code for a `Resume` terminator.
176
- fn codegen_resume_terminator < ' b > (
177
+ fn codegen_resume_terminator (
177
178
& mut self ,
178
- helper : TerminatorCodegenHelper < ' b , ' tcx > ,
179
+ helper : TerminatorCodegenHelper < ' tcx > ,
179
180
mut bx : Bx ,
180
181
) {
181
182
if let Some ( funclet) = helper. funclet ( self ) {
@@ -201,9 +202,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
201
202
}
202
203
}
203
204
204
- fn codegen_switchint_terminator < ' b > (
205
+ fn codegen_switchint_terminator (
205
206
& mut self ,
206
- helper : TerminatorCodegenHelper < ' b , ' tcx > ,
207
+ helper : TerminatorCodegenHelper < ' tcx > ,
207
208
mut bx : Bx ,
208
209
discr : & mir:: Operand < ' tcx > ,
209
210
switch_ty : Ty < ' tcx > ,
@@ -316,9 +317,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
316
317
}
317
318
318
319
319
- fn codegen_drop_terminator < ' b > (
320
+ fn codegen_drop_terminator (
320
321
& mut self ,
321
- helper : TerminatorCodegenHelper < ' b , ' tcx > ,
322
+ helper : TerminatorCodegenHelper < ' tcx > ,
322
323
mut bx : Bx ,
323
324
location : & mir:: Place < ' tcx > ,
324
325
target : mir:: BasicBlock ,
@@ -367,9 +368,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
367
368
unwind) ;
368
369
}
369
370
370
- fn codegen_assert_terminator < ' b > (
371
+ fn codegen_assert_terminator (
371
372
& mut self ,
372
- helper : TerminatorCodegenHelper < ' b , ' tcx > ,
373
+ helper : TerminatorCodegenHelper < ' tcx > ,
373
374
mut bx : Bx ,
374
375
terminator : & mir:: Terminator < ' tcx > ,
375
376
cond : & mir:: Operand < ' tcx > ,
@@ -446,9 +447,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
446
447
helper. do_call ( self , & mut bx, fn_abi, llfn, & args, None , cleanup) ;
447
448
}
448
449
449
- fn codegen_call_terminator < ' b > (
450
+ fn codegen_call_terminator (
450
451
& mut self ,
451
- helper : TerminatorCodegenHelper < ' b , ' tcx > ,
452
+ helper : TerminatorCodegenHelper < ' tcx > ,
452
453
mut bx : Bx ,
453
454
terminator : & mir:: Terminator < ' tcx > ,
454
455
func : & mir:: Operand < ' tcx > ,
@@ -798,14 +799,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
798
799
& mut self ,
799
800
mut bx : Bx ,
800
801
bb : mir:: BasicBlock ,
801
- terminator : & mir:: Terminator < ' tcx >
802
+ terminator : & ' tcx mir:: Terminator < ' tcx >
802
803
) {
803
804
debug ! ( "codegen_terminator: {:?}" , terminator) ;
804
805
805
806
// Create the cleanup bundle, if needed.
806
807
let funclet_bb = self . cleanup_kinds [ bb] . funclet_bb ( bb) ;
807
808
let helper = TerminatorCodegenHelper {
808
- bb : & bb , terminator, funclet_bb
809
+ bb, terminator, funclet_bb
809
810
} ;
810
811
811
812
self . set_debug_loc ( & mut bx, terminator. source_info ) ;
0 commit comments