Skip to content

Commit

Permalink
fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Ariel Ben-Yehuda authored and arielb1 committed Jun 9, 2016
1 parent f5b1ba6 commit ce4fdef
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/librustc_driver/driver.rs
Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion src/librustc_mir/build/cfg.rs
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions src/librustc_mir/build/matches/mod.rs
Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions src/rustc/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ce4fdef

Please sign in to comment.