Rollup merge of #110657 - miguelraz:cleanup-simplifycfg-refactor, r=compiler-errors

nit: consistent naming for SimplifyConstCondition

Fixing a small naming inconsistency that `@JakobDegen` brought up in https://github.com/rust-lang/rust/pull/110477#discussion_r1170783823.

Please signal for rollup.
This commit is contained in:
Yuki Okushi 2023-04-22 10:33:58 +09:00 committed by GitHub
commit 617ecd2a7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 8 deletions

View File

@ -507,12 +507,12 @@ fn o1<T>(x: T) -> WithMinOptLevel<T> {
//
// Const-prop runs unconditionally, but doesn't mutate the MIR at mir-opt-level=0.
&const_debuginfo::ConstDebugInfo,
&o1(simplify_branches::SimplifyConstConditionPassName::AfterConstProp),
&o1(simplify_branches::SimplifyConstCondition::AfterConstProp),
&early_otherwise_branch::EarlyOtherwiseBranch,
&simplify_comparison_integral::SimplifyComparisonIntegral,
&dead_store_elimination::DeadStoreElimination,
&dest_prop::DestinationPropagation,
&o1(simplify_branches::SimplifyConstConditionPassName::Final),
&o1(simplify_branches::SimplifyConstCondition::Final),
&o1(remove_noop_landing_pads::RemoveNoopLandingPads),
&o1(simplify::SimplifyCfg::Final),
&nrvo::RenameReturnPlace,

View File

@ -2,18 +2,16 @@
use rustc_middle::mir::*;
use rustc_middle::ty::TyCtxt;
pub enum SimplifyConstConditionPassName {
pub enum SimplifyConstCondition {
AfterConstProp,
Final,
}
/// A pass that replaces a branch with a goto when its condition is known.
impl<'tcx> MirPass<'tcx> for SimplifyConstConditionPassName {
impl<'tcx> MirPass<'tcx> for SimplifyConstCondition {
fn name(&self) -> &'static str {
match self {
SimplifyConstConditionPassName::AfterConstProp => {
"SimplifyConstCondition-after-const-prop"
}
SimplifyConstConditionPassName::Final => "SimplifyConstCondition-final",
SimplifyConstCondition::AfterConstProp => "SimplifyConstCondition-after-const-prop",
SimplifyConstCondition::Final => "SimplifyConstCondition-final",
}
}