1
Fork 0

Fix CR feedback

This commit is contained in:
Wesley Wiser 2018-10-25 08:35:53 -04:00
parent c535147f29
commit 4655866a11
2 changed files with 7 additions and 11 deletions

View file

@ -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
}
}

View file

@ -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| {