fix issues
This commit is contained in:
parent
f5b1ba6e90
commit
ce4fdefbd8
@ -980,7 +980,8 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
|
||||
passes.push_pass(box mir::transform::simplify_cfg::SimplifyCfg::new("initial"));
|
||||
passes.push_pass(box mir::transform::qualify_consts::QualifyAndPromoteConstants);
|
||||
passes.push_pass(box mir::transform::type_check::TypeckMir);
|
||||
passes.push_pass(box mir::transform::simplify_branches::SimplifyBranches::new("initial"));
|
||||
passes.push_pass(
|
||||
box mir::transform::simplify_branches::SimplifyBranches::new("initial"));
|
||||
passes.push_pass(box mir::transform::simplify_cfg::SimplifyCfg::new("qualify-consts"));
|
||||
// And run everything.
|
||||
passes.run_passes(tcx, &mut mir_map);
|
||||
|
@ -78,8 +78,11 @@ impl<'tcx> CFG<'tcx> {
|
||||
block: BasicBlock,
|
||||
source_info: SourceInfo,
|
||||
kind: TerminatorKind<'tcx>) {
|
||||
debug!("terminating block {:?} <- {:?}", block, kind);
|
||||
debug_assert!(self.block_data(block).terminator.is_none(),
|
||||
"terminate: block {:?} already has a terminator set", block);
|
||||
"terminate: block {:?}={:?} already has a terminator set",
|
||||
block,
|
||||
self.block_data(block));
|
||||
self.block_data_mut(block).terminator = Some(Terminator {
|
||||
source_info: source_info,
|
||||
kind: kind,
|
||||
|
@ -87,6 +87,9 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
|
||||
// can't be reached - terminate them with an `unreachable`.
|
||||
let source_info = self.source_info(span);
|
||||
|
||||
let mut otherwise = otherwise;
|
||||
otherwise.sort();
|
||||
otherwise.dedup(); // variant switches can introduce duplicate target blocks
|
||||
for block in otherwise {
|
||||
self.cfg.terminate(block, source_info, TerminatorKind::Unreachable);
|
||||
}
|
||||
|
1
src/rustc/Cargo.lock
generated
1
src/rustc/Cargo.lock
generated
@ -87,6 +87,7 @@ dependencies = [
|
||||
"graphviz 0.0.0",
|
||||
"log 0.0.0",
|
||||
"rustc 0.0.0",
|
||||
"rustc_data_structures 0.0.0",
|
||||
"rustc_mir 0.0.0",
|
||||
"syntax 0.0.0",
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user