mirror of
https://github.com/rust-lang/rust.git
synced 2025-11-24 05:17:19 +00:00
error from const eval lint causes ICE at check_pat in late_lint, because the function expects the typeck result isn't tainted by error but it is. To avoid the ICE, check_pat returns earlier if the typeck_result is tainted. check_mod_deathness also has an issue from the same reason. visit_body for making live symbols expects the typeck result has no error. So this commit adds a check in visit_nested_body to avoid the ICE. However, if visit_nested_body just returns without doing anything, all codes with the error are marked as dead, because live_symbols is empty. To avoid this side effect, visit_nested_body and other visit_* functions in MarkSymbolVistior should return appropriate error. If a function returns ControlFlow::Break, live_symbols_and_ignore_derived_traits returns earlier with error, then check_mod_deathness, the caller of the function returns earlier without pushing everything into dead_codes.