|
4 | 4 |
|
5 | 5 | use rustc::ty::TyCtxt;
|
6 | 6 | use rustc::mir::{self, Body, Location};
|
7 |
| -use rustc_data_structures::bit_set::{BitSet, BitSetOperator}; |
| 7 | +use rustc_data_structures::bit_set::BitSet; |
8 | 8 | use rustc_data_structures::indexed_vec::Idx;
|
9 | 9 |
|
10 | 10 | use super::MoveDataParamEnv;
|
11 | 11 |
|
12 | 12 | use crate::util::elaborate_drops::DropFlagState;
|
13 | 13 |
|
14 | 14 | use super::move_paths::{HasMoveData, MoveData, MovePathIndex, InitIndex, InitKind};
|
15 |
| -use super::{BitDenotation, InitialFlow, GenKillSet}; |
| 15 | +use super::{BitDenotation, BottomValue, GenKillSet}; |
16 | 16 |
|
17 | 17 | use super::drop_flag_effects_for_function_entry;
|
18 | 18 | use super::drop_flag_effects_for_location;
|
@@ -505,68 +505,22 @@ impl<'a, 'tcx> BitDenotation<'tcx> for EverInitializedPlaces<'a, 'tcx> {
|
505 | 505 | }
|
506 | 506 | }
|
507 | 507 |
|
508 |
| -impl<'a, 'tcx> BitSetOperator for MaybeInitializedPlaces<'a, 'tcx> { |
509 |
| - #[inline] |
510 |
| - fn join<T: Idx>(&self, inout_set: &mut BitSet<T>, in_set: &BitSet<T>) -> bool { |
511 |
| - inout_set.union(in_set) // "maybe" means we union effects of both preds |
512 |
| - } |
513 |
| -} |
514 |
| - |
515 |
| -impl<'a, 'tcx> BitSetOperator for MaybeUninitializedPlaces<'a, 'tcx> { |
516 |
| - #[inline] |
517 |
| - fn join<T: Idx>(&self, inout_set: &mut BitSet<T>, in_set: &BitSet<T>) -> bool { |
518 |
| - inout_set.union(in_set) // "maybe" means we union effects of both preds |
519 |
| - } |
520 |
| -} |
521 |
| - |
522 |
| -impl<'a, 'tcx> BitSetOperator for DefinitelyInitializedPlaces<'a, 'tcx> { |
523 |
| - #[inline] |
524 |
| - fn join<T: Idx>(&self, inout_set: &mut BitSet<T>, in_set: &BitSet<T>) -> bool { |
525 |
| - inout_set.intersect(in_set) // "definitely" means we intersect effects of both preds |
526 |
| - } |
527 |
| -} |
528 |
| - |
529 |
| -impl<'a, 'tcx> BitSetOperator for EverInitializedPlaces<'a, 'tcx> { |
530 |
| - #[inline] |
531 |
| - fn join<T: Idx>(&self, inout_set: &mut BitSet<T>, in_set: &BitSet<T>) -> bool { |
532 |
| - inout_set.union(in_set) // inits from both preds are in scope |
533 |
| - } |
534 |
| -} |
535 |
| - |
536 |
| -// The way that dataflow fixed point iteration works, you want to |
537 |
| -// start at bottom and work your way to a fixed point. Control-flow |
538 |
| -// merges will apply the `join` operator to each block entry's current |
539 |
| -// state (which starts at that bottom value). |
540 |
| -// |
541 |
| -// This means, for propagation across the graph, that you either want |
542 |
| -// to start at all-zeroes and then use Union as your merge when |
543 |
| -// propagating, or you start at all-ones and then use Intersect as |
544 |
| -// your merge when propagating. |
545 |
| - |
546 |
| -impl<'a, 'tcx> InitialFlow for MaybeInitializedPlaces<'a, 'tcx> { |
547 |
| - #[inline] |
548 |
| - fn bottom_value() -> bool { |
549 |
| - false // bottom = uninitialized |
550 |
| - } |
| 508 | +impl<'a, 'tcx> BottomValue for MaybeInitializedPlaces<'a, 'tcx> { |
| 509 | + /// bottom = uninitialized |
| 510 | + const BOTTOM_VALUE: bool = false; |
551 | 511 | }
|
552 | 512 |
|
553 |
| -impl<'a, 'tcx> InitialFlow for MaybeUninitializedPlaces<'a, 'tcx> { |
554 |
| - #[inline] |
555 |
| - fn bottom_value() -> bool { |
556 |
| - false // bottom = initialized (start_block_effect counters this at outset) |
557 |
| - } |
| 513 | +impl<'a, 'tcx> BottomValue for MaybeUninitializedPlaces<'a, 'tcx> { |
| 514 | + /// bottom = initialized (start_block_effect counters this at outset) |
| 515 | + const BOTTOM_VALUE: bool = false; |
558 | 516 | }
|
559 | 517 |
|
560 |
| -impl<'a, 'tcx> InitialFlow for DefinitelyInitializedPlaces<'a, 'tcx> { |
561 |
| - #[inline] |
562 |
| - fn bottom_value() -> bool { |
563 |
| - true // bottom = initialized (start_block_effect counters this at outset) |
564 |
| - } |
| 518 | +impl<'a, 'tcx> BottomValue for DefinitelyInitializedPlaces<'a, 'tcx> { |
| 519 | + /// bottom = initialized (start_block_effect counters this at outset) |
| 520 | + const BOTTOM_VALUE: bool = true; |
565 | 521 | }
|
566 | 522 |
|
567 |
| -impl<'a, 'tcx> InitialFlow for EverInitializedPlaces<'a, 'tcx> { |
568 |
| - #[inline] |
569 |
| - fn bottom_value() -> bool { |
570 |
| - false // bottom = no initialized variables by default |
571 |
| - } |
| 523 | +impl<'a, 'tcx> BottomValue for EverInitializedPlaces<'a, 'tcx> { |
| 524 | + /// bottom = no initialized variables by default |
| 525 | + const BOTTOM_VALUE: bool = false; |
572 | 526 | }
|
0 commit comments