rust/compiler/rustc_hir_analysis
Dylan DPC 48c5e0c262
Rollup merge of #103034 - nathanwhit:let-chains-rhs-temporaries, r=wesleywiser
Let expressions on RHS shouldn't be terminating scopes

Fixes #100276.

Before this PR, we were unconditionally marking the RHS of short-circuiting binary expressions as a terminating scope.

In the case of a let chain where the `let` expression was on the RHS, this meant that temporaries within the `let` expr would only live until the end of the expression. Since this only affected the RHS, this led to surprising behavior ([example](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=d1b0a5d1f01882f9c89c2194a75eb19f)).

After this PR, we only mark the RHS as a terminating scope if it is not a `let` expression.
2022-10-19 14:05:52 +05:30
..
src Rollup merge of #103034 - nathanwhit:let-chains-rhs-temporaries, r=wesleywiser 2022-10-19 14:05:52 +05:30
Cargo.toml Rewrite representability 2022-10-07 09:33:46 -05:00
README.md rustc_typeck to rustc_hir_analysis 2022-09-27 10:37:23 +02:00

For high-level intro to how type checking works in rustc, see the type checking chapter of the rustc dev guide.