Restore if let guard temporary scoping difference
Match guards with an if let guard or an if let chain guard should have a temporary scope of the whole arm. This is to allow ref bindings to temporaries to borrow check.
This commit is contained in:
parent
a549711f6e
commit
1a267e3f40
3 changed files with 89 additions and 2 deletions
|
@ -33,6 +33,12 @@ use std::borrow::Borrow;
|
|||
use std::mem;
|
||||
|
||||
impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
/// Lowers a condition in a way that ensures that variables bound in any let
|
||||
/// expressions are definitely initialized in the if body.
|
||||
///
|
||||
/// If `declare_bindings` is false then variables created in `let`
|
||||
/// expressions will not be declared. This is for if let guards on arms with
|
||||
/// an or pattern, where the guard is lowered multiple times.
|
||||
pub(crate) fn then_else_break(
|
||||
&mut self,
|
||||
mut block: BasicBlock,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue