@@ -101,31 +101,37 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
101
101
) ,
102
102
ExprKind :: Become { value } => {
103
103
let v = & this. thir [ value] ;
104
- let ExprKind :: Scope { value, .. } = v. kind
104
+ let ExprKind :: Scope { region_scope , lint_level , value, .. } = v. kind
105
105
else { span_bug ! ( v. span, "`thir_check_tail_calls` should have disallowed this {v:?}" ) } ;
106
106
107
107
let v = & this. thir [ value] ;
108
108
let ExprKind :: Call { ref args, fun, fn_span, .. } = v. kind
109
109
else { span_bug ! ( v. span, "`thir_check_tail_calls` should have disallowed this {v:?}" ) } ;
110
110
111
- let fun = unpack ! ( block = this. as_local_operand( block, & this. thir[ fun] ) ) ;
112
- let args: Vec < _ > = args
113
- . into_iter ( )
114
- . copied ( )
115
- . map ( |arg| unpack ! ( block = this. as_local_call_operand( block, & this. thir[ arg] ) ) )
116
- . collect ( ) ;
111
+ this. in_scope ( ( region_scope, source_info) , lint_level, |this| {
112
+ let fun = unpack ! ( block = this. as_local_operand( block, & this. thir[ fun] ) ) ;
113
+ let args: Vec < _ > = args
114
+ . into_iter ( )
115
+ . copied ( )
116
+ . map ( |arg| {
117
+ unpack ! ( block = this. as_local_call_operand( block, & this. thir[ arg] ) )
118
+ } )
119
+ . collect ( ) ;
117
120
118
- this. record_operands_moved ( & args) ;
121
+ this. record_operands_moved ( & args) ;
119
122
120
- debug ! ( "expr_into_dest: fn_span={:?}" , fn_span) ;
123
+ debug ! ( "expr_into_dest: fn_span={:?}" , fn_span) ;
121
124
122
- this. cfg . terminate (
123
- block,
124
- source_info,
125
- TerminatorKind :: TailCall { func : fun, args, fn_span } ,
126
- ) ;
125
+ unpack ! ( block = this. break_for_tail_call( block) ) ;
127
126
128
- this. cfg . start_new_block ( ) . unit ( )
127
+ this. cfg . terminate (
128
+ block,
129
+ source_info,
130
+ TerminatorKind :: TailCall { func : fun, args, fn_span } ,
131
+ ) ;
132
+
133
+ this. cfg . start_new_block ( ) . unit ( )
134
+ } )
129
135
}
130
136
_ => {
131
137
assert ! (
0 commit comments