treat an error taint from const eval lint in late_lint and check_mod_deathness
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.
This commit is contained in:
@@ -1202,10 +1202,10 @@ rustc_queries! {
|
||||
/// Return the live symbols in the crate for dead code check.
|
||||
///
|
||||
/// The second return value maps from ADTs to ignored derived traits (e.g. Debug and Clone).
|
||||
query live_symbols_and_ignored_derived_traits(_: ()) -> &'tcx (
|
||||
query live_symbols_and_ignored_derived_traits(_: ()) -> &'tcx Result<(
|
||||
LocalDefIdSet,
|
||||
LocalDefIdMap<FxIndexSet<DefId>>,
|
||||
) {
|
||||
), ErrorGuaranteed> {
|
||||
arena_cache
|
||||
desc { "finding live symbols in crate" }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user