diff options
| author | bors <bors@rust-lang.org> | 2022-07-25 22:57:23 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-07-25 22:57:23 +0000 |
| commit | a86705942c4cfaaee60f2e7308ca2bca703a710f (patch) | |
| tree | 133bd48f82d214929324a7e2337871b505adb8e5 /compiler/rustc_mir_transform/src/const_prop.rs | |
| parent | 6dbae3ad19309bb541d9e76638e6aa4b5449f29a (diff) | |
| parent | e58bfacd90bea9fab8bdbd9cf6129290937fed63 (diff) | |
| download | rust-a86705942c4cfaaee60f2e7308ca2bca703a710f.tar.gz rust-a86705942c4cfaaee60f2e7308ca2bca703a710f.zip | |
Auto merge of #99735 - JohnTitor:rollup-d93jyr2, r=JohnTitor
Rollup of 9 pull requests Successful merges: - #92390 (Constify a few `(Partial)Ord` impls) - #97077 (Simplify some code that depend on Deref) - #98710 (correct the output of a `capacity` method example) - #99084 (clarify how write_bytes can lead to UB due to invalid values) - #99178 (Lighten up const_prop_lint, reusing const_prop) - #99673 (don't ICE on invalid dyn calls) - #99703 (Expose size_hint() for TokenStream's iterator) - #99709 (`Inherited` always has `TypeckResults` available) - #99713 (Fix sidebar background) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_mir_transform/src/const_prop.rs')
| -rw-r--r-- | compiler/rustc_mir_transform/src/const_prop.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/rustc_mir_transform/src/const_prop.rs b/compiler/rustc_mir_transform/src/const_prop.rs index f6484a9b54d..85ad6b8f2fe 100644 --- a/compiler/rustc_mir_transform/src/const_prop.rs +++ b/compiler/rustc_mir_transform/src/const_prop.rs @@ -155,18 +155,18 @@ impl<'tcx> MirPass<'tcx> for ConstProp { } } -struct ConstPropMachine<'mir, 'tcx> { +pub struct ConstPropMachine<'mir, 'tcx> { /// The virtual call stack. stack: Vec<Frame<'mir, 'tcx>>, /// `OnlyInsideOwnBlock` locals that were written in the current block get erased at the end. - written_only_inside_own_block_locals: FxHashSet<Local>, + pub written_only_inside_own_block_locals: FxHashSet<Local>, /// Locals that need to be cleared after every block terminates. - only_propagate_inside_block_locals: BitSet<Local>, - can_const_prop: IndexVec<Local, ConstPropMode>, + pub only_propagate_inside_block_locals: BitSet<Local>, + pub can_const_prop: IndexVec<Local, ConstPropMode>, } impl ConstPropMachine<'_, '_> { - fn new( + pub fn new( only_propagate_inside_block_locals: BitSet<Local>, can_const_prop: IndexVec<Local, ConstPropMode>, ) -> Self { @@ -816,7 +816,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { /// The mode that `ConstProp` is allowed to run in for a given `Local`. #[derive(Clone, Copy, Debug, PartialEq)] -enum ConstPropMode { +pub enum ConstPropMode { /// The `Local` can be propagated into and reads of this `Local` can also be propagated. FullConstProp, /// The `Local` can only be propagated into and from its own block. @@ -828,7 +828,7 @@ enum ConstPropMode { NoPropagation, } -struct CanConstProp { +pub struct CanConstProp { can_const_prop: IndexVec<Local, ConstPropMode>, // False at the beginning. Once set, no more assignments are allowed to that local. found_assignment: BitSet<Local>, @@ -838,7 +838,7 @@ struct CanConstProp { impl CanConstProp { /// Returns true if `local` can be propagated - fn check<'tcx>( + pub fn check<'tcx>( tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>, body: &Body<'tcx>, |
