@@ -2280,15 +2280,16 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2280
2280
mut block : BasicBlock ,
2281
2281
init : & Expr < ' tcx > ,
2282
2282
initializer_span : Span ,
2283
- else_block : & Block ,
2283
+ else_block : BlockId ,
2284
2284
visibility_scope : Option < SourceScope > ,
2285
2285
remainder_scope : region:: Scope ,
2286
2286
remainder_span : Span ,
2287
2287
pattern : & Pat < ' tcx > ,
2288
2288
) -> BlockAnd < ( ) > {
2289
+ let else_block_span = self . thir [ else_block] . span ;
2289
2290
let ( matching, failure) = self . in_if_then_scope ( remainder_scope, |this| {
2290
2291
let scrutinee = unpack ! ( block = this. lower_scrutinee( block, init, initializer_span) ) ;
2291
- let pat = Pat { ty : init. ty , span : else_block . span , kind : Box :: new ( PatKind :: Wild ) } ;
2292
+ let pat = Pat { ty : init. ty , span : else_block_span , kind : Box :: new ( PatKind :: Wild ) } ;
2292
2293
let mut wildcard = Candidate :: new ( scrutinee. clone ( ) , & pat, false ) ;
2293
2294
this. declare_bindings (
2294
2295
visibility_scope,
@@ -2318,7 +2319,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2318
2319
) ;
2319
2320
// This block is for the failure case
2320
2321
let failure = this. bind_pattern (
2321
- this. source_info ( else_block . span ) ,
2322
+ this. source_info ( else_block_span ) ,
2322
2323
wildcard,
2323
2324
None ,
2324
2325
& fake_borrow_temps,
@@ -2334,19 +2335,19 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2334
2335
// This place is not really used because this destination place
2335
2336
// should never be used to take values at the end of the failure
2336
2337
// block.
2337
- let dummy_place = self . temp ( self . tcx . types . never , else_block . span ) ;
2338
+ let dummy_place = self . temp ( self . tcx . types . never , else_block_span ) ;
2338
2339
let failure_block;
2339
2340
unpack ! (
2340
2341
failure_block = self . ast_block(
2341
2342
dummy_place,
2342
2343
failure,
2343
2344
else_block,
2344
- self . source_info( else_block . span ) ,
2345
+ self . source_info( else_block_span ) ,
2345
2346
)
2346
2347
) ;
2347
2348
self . cfg . terminate (
2348
2349
failure_block,
2349
- self . source_info ( else_block . span ) ,
2350
+ self . source_info ( else_block_span ) ,
2350
2351
TerminatorKind :: Unreachable ,
2351
2352
) ;
2352
2353
matching. unit ( )
0 commit comments