Closed
Description
This code
fn slice_index() -> u8 {
let arr: &[_] = &[101, 102, 103, 104, 105, 106];
arr[5]
}
results in the following MIR (before region erasure):
_3 = &ReScope(Remainder(BlockRemainder { block: NodeId(92), first_statement_index: 0 })) _4;
...
StorageDead(_4);
EndRegion(ReScope(Remainder(BlockRemainder { block: NodeId(92), first_statement_index: 0 })));
So, _4
is borrowed for this scope, but actually it is marked dead before the scope ends. That seems wrong to me, shouldn't _4
have to be live at least until the region ends?