rust/compiler/rustc_typeck
Dylan DPC dc8fe633d5
Rollup merge of #101217 - eholk:drop-tracking-73137, r=jyn514
[drop tracking] Use parent expression for scope, not parent node

Previously we were just using the parent node as the scope for a temporary value, but it turns out this is too narrow. For example, in an expression like

    Foo {
        b: &42,
        a: async { 0 }.await,
    }

the scope for the &42 was set to the ExprField node for `b: &42`, when we actually want to use the Foo struct expression.

We fix this by recursively searching through parent nodes until we find a Node::Expr. It may be that we don't find one, and if so that's okay, we will just fall back on the enclosing temporary scope which is always sufficient.

Helps with #97331

r? ``@jyn514``
2022-09-03 10:33:06 +05:30
..
src Rollup merge of #101217 - eholk:drop-tracking-73137, r=jyn514 2022-09-03 10:33:06 +05:30
Cargo.toml Improve error message for unstable default body 2022-07-26 15:40:04 +04:00
README.md

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