Skip to content

Commit

Permalink
Fix CR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleywiser committed Oct 25, 2018
1 parent c535147 commit 4655866
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
15 changes: 5 additions & 10 deletions src/librustc/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,16 @@ impl<'tcx> HasLocalDecls<'tcx> for Mir<'tcx> {
/// Warning: ordering of variants is significant
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum MirPhase {
Build,
Const,
Validated,
Optimized,
Build = 0,
Const = 1,
Validated = 2,
Optimized = 3,
}

impl MirPhase {
/// Gets the index of the current MirPhase within the set of all MirPhases.
pub fn phase_index(&self) -> usize {
match self {
MirPhase::Build => 0,
MirPhase::Const => 1,
MirPhase::Validated => 2,
MirPhase::Optimized => 3,
}
*self as usize
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/librustc_mir/transform/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ pub fn run_passes(
mir: &mut Mir<'tcx>,
def_id: DefId,
mir_phase: MirPhase,
passes: &[&dyn MirPass]) {
passes: &[&dyn MirPass],
) {
let phase_index = mir_phase.phase_index();

let run_passes = |mir: &mut Mir<'tcx>, promoted| {
Expand Down

0 comments on commit 4655866

Please sign in to comment.