Skip to content

Remove unused cached_unreachable_block from MIR builder #78039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions compiler/rustc_mir_build/src/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,6 @@ struct Builder<'a, 'tcx> {
unit_temp: Option<Place<'tcx>>,

var_debug_info: Vec<VarDebugInfo<'tcx>>,

/// Cached block with the `UNREACHABLE` terminator.
cached_unreachable_block: Option<BasicBlock>,
}

impl<'a, 'tcx> Builder<'a, 'tcx> {
Expand Down Expand Up @@ -634,10 +631,6 @@ where
builder.cfg.terminate(return_block, source_info, TerminatorKind::Return);
let should_abort = should_abort_on_panic(tcx, fn_def_id, abi);
builder.build_drop_trees(should_abort);
// Attribute any unreachable codepaths to the function's closing brace
if let Some(unreachable_block) = builder.cached_unreachable_block {
builder.cfg.terminate(unreachable_block, source_info, TerminatorKind::Unreachable);
}
return_block.unit()
}));

Expand Down Expand Up @@ -676,12 +669,6 @@ fn construct_const<'a, 'tcx>(

builder.build_drop_trees(false);

// Constants may be match expressions in which case an unreachable block may
// be created, so terminate it properly.
if let Some(unreachable_block) = builder.cached_unreachable_block {
builder.cfg.terminate(unreachable_block, source_info, TerminatorKind::Unreachable);
}

builder.finish()
}

Expand Down Expand Up @@ -757,7 +744,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
var_indices: Default::default(),
unit_temp: None,
var_debug_info: vec![],
cached_unreachable_block: None,
};

assert_eq!(builder.cfg.start_new_block(), START_BLOCK);
Expand Down