Skip to content

Commit 9a81cae

Browse files
committed
Auto merge of #119122 - matthewjasper:if-let-guard-scoping, r=TaKO8Ki
Give temporaries in if let guards correct scopes Temporaries in if-let guards have scopes that escape the match arm, this causes problems because the drops might be for temporaries that are not storage live. This PR changes the scope of temporaries in if-let guards to be limited to the arm: ```rust _ if let Some(s) = std::convert::identity(&Some(String::new())) => {} // Temporary for Some(String::new()) is dropped here ^ ``` We also now deduplicate temporaries between copies of the guard created for or-patterns: ```rust // Only create a single Some(String::new()) temporary variable _ | _ if let Some(s) = std::convert::identity(&Some(String::new())) => {} ``` This changes MIR building to pass around `ExprId`s rather than `Expr`s so that we have a way to index different expressions. cc #51114 Closes #116079
2 parents cd65fee + d86f97f commit 9a81cae

File tree

0 file changed

+0
-0
lines changed

    0 file changed

    +0
    -0
    lines changed

    0 commit comments

    Comments
     (0)