mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
f1e691da2e
Check whether the closure's owner is an ADT in thir-unsafeck This pull request fixes #85871. The code in `rustc_mir_build/src/check_unsafety.rs` incorrectly assumes that a closure's owner always has a body, but only functions, closures, and constants have bodies, whereas a closure can also appear inside a struct or enum: ```rust struct S { arr: [(); match || 1 { _ => 42 }] } enum E { A([(); { || 1; 42 }]) } ``` This pull request fixes the resulting ICE by checking whether the closure's owner is an ADT and only deferring to `thir_check_unsafety(owner)` if it isn't. |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |