mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 01:13:11 +00:00
Rollup merge of #120280 - tmiasko:is-enabled, r=compiler-errors
Move condition enabling the pass to `is_enabled` The practical motivation is to omit the pass from -Zdump-mir=all when disabled.
This commit is contained in:
commit
08bac31f8f
@ -7,14 +7,10 @@ pub struct RemoveStorageMarkers;
|
|||||||
|
|
||||||
impl<'tcx> MirPass<'tcx> for RemoveStorageMarkers {
|
impl<'tcx> MirPass<'tcx> for RemoveStorageMarkers {
|
||||||
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
|
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
|
||||||
sess.mir_opt_level() > 0
|
sess.mir_opt_level() > 0 && !sess.emit_lifetime_markers()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
fn run_pass(&self, _tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||||
if tcx.sess.emit_lifetime_markers() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
trace!("Running RemoveStorageMarkers on {:?}", body.source);
|
trace!("Running RemoveStorageMarkers on {:?}", body.source);
|
||||||
for data in body.basic_blocks.as_mut_preserves_cfg() {
|
for data in body.basic_blocks.as_mut_preserves_cfg() {
|
||||||
data.statements.retain(|statement| match statement.kind {
|
data.statements.retain(|statement| match statement.kind {
|
||||||
|
Loading…
Reference in New Issue
Block a user