diff options
Diffstat (limited to 'compiler/rustc_mir_dataflow/src/drop_flag_effects.rs')
| -rw-r--r-- | compiler/rustc_mir_dataflow/src/drop_flag_effects.rs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/compiler/rustc_mir_dataflow/src/drop_flag_effects.rs b/compiler/rustc_mir_dataflow/src/drop_flag_effects.rs index e5cddd0e5e4..496a342cf4c 100644 --- a/compiler/rustc_mir_dataflow/src/drop_flag_effects.rs +++ b/compiler/rustc_mir_dataflow/src/drop_flag_effects.rs @@ -3,7 +3,26 @@ use rustc_middle::mir::{self, Body, Location, Terminator, TerminatorKind}; use tracing::debug; use super::move_paths::{InitKind, LookupResult, MoveData, MovePathIndex}; -use crate::elaborate_drops::DropFlagState; + +/// The value of an inserted drop flag. +#[derive(Debug, PartialEq, Eq, Copy, Clone)] +pub enum DropFlagState { + /// The tracked value is initialized and needs to be dropped when leaving its scope. + Present, + + /// The tracked value is uninitialized or was moved out of and does not need to be dropped when + /// leaving its scope. + Absent, +} + +impl DropFlagState { + pub fn value(self) -> bool { + match self { + DropFlagState::Present => true, + DropFlagState::Absent => false, + } + } +} pub fn move_path_children_matching<'tcx, F>( move_data: &MoveData<'tcx>, |
