mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-17 14:13:24 +03:00
a5b7511a6c
Fix ICE with `-Zunpretty=hir,typed` This PR fixes #82328. The `-Zunpretty=hir,typed` pretty-printer maintains an `Option` with type-checking results and sets the `Option` to `Some` when entering a body. However, this leads to an ICE if an expression occurs in a function signature (i.e. outside of a body), such as `128` in ```rust fn foo(-128..=127: i8) {} ``` This PR fixes the ICE by checking (if necessary) whether the expression's owner has a body, and retrieving type-checking results for that on the fly.