@@ -44,6 +44,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
44
44
self . then_else_break_inner (
45
45
block,
46
46
expr,
47
+ None ,
47
48
temp_scope_override,
48
49
break_scope,
49
50
variable_source_info,
@@ -54,6 +55,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
54
55
& mut self ,
55
56
mut block : BasicBlock ,
56
57
expr : & Expr < ' tcx > ,
58
+ enclosing_not_expr : Option < & Expr < ' tcx > > , // Only used by coverage instrumentation
57
59
temp_scope_override : Option < region:: Scope > ,
58
60
break_scope : region:: Scope ,
59
61
variable_source_info : SourceInfo ,
@@ -107,9 +109,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
107
109
let local_scope = this. local_scope ( ) ;
108
110
let ( success_block, failure_block) =
109
111
this. in_if_then_scope ( local_scope, expr_span, |this| {
110
- this. then_else_break (
112
+ this. then_else_break_inner (
111
113
block,
112
114
& this. thir [ arg] ,
115
+ Some ( expr) ,
113
116
temp_scope_override,
114
117
local_scope,
115
118
variable_source_info,
@@ -121,9 +124,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
121
124
ExprKind :: Scope { region_scope, lint_level, value } => {
122
125
let region_scope = ( region_scope, this. source_info ( expr_span) ) ;
123
126
this. in_scope ( region_scope, lint_level, |this| {
124
- this. then_else_break (
127
+ this. then_else_break_inner (
125
128
block,
126
129
& this. thir [ value] ,
130
+ enclosing_not_expr,
127
131
temp_scope_override,
128
132
break_scope,
129
133
variable_source_info,
@@ -162,7 +166,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
162
166
if let Some ( coverage) = & this. coverage
163
167
&& coverage. branch_coverage_enabled
164
168
{
165
- this. coverage_add_branch ( source_info, & mut then_block, & mut else_block) ;
169
+ this. coverage_add_branch (
170
+ source_info,
171
+ enclosing_not_expr,
172
+ & mut then_block,
173
+ & mut else_block,
174
+ ) ;
166
175
}
167
176
168
177
this. cfg . terminate ( block, source_info, term) ;
0 commit comments