]>
Commit | Line | Data |
---|---|---|
a2a8927a XL |
1 | use std::borrow::Cow; |
2 | ||
3 | use crate::MirPass; | |
4 | use rustc_middle::mir::{Body, MirPhase}; | |
5 | use rustc_middle::ty::TyCtxt; | |
6 | ||
7 | /// Changes the MIR phase without changing the MIR itself. | |
8 | pub struct PhaseChange(pub MirPhase); | |
9 | ||
10 | impl<'tcx> MirPass<'tcx> for PhaseChange { | |
11 | fn phase_change(&self) -> Option<MirPhase> { | |
12 | Some(self.0) | |
13 | } | |
14 | ||
15 | fn name(&self) -> Cow<'_, str> { | |
16 | Cow::from(format!("PhaseChange-{:?}", self.0)) | |
17 | } | |
18 | ||
19 | fn run_pass(&self, _: TyCtxt<'tcx>, _body: &mut Body<'tcx>) {} | |
20 | } |