fn filter_conditions<'c>(
        &self,
        entry_point: FunctionEntryPoint,
        opaque: bool,
        export_ensures: bool,
        kinds: &[ConditionKind],
        conditions: &'c [Condition],
    ) -> Vec<&'c Condition> {
        use ConditionKind::*;
        use FunctionEntryPoint::*;
        conditions
            .iter()
            .filter(|cond| {
                if !kinds.contains(&cond.kind) {
                    return false;
                }
                let env = self.module_env().env;
                let abstract_ = env
                    .is_property_true(&cond.properties, CONDITION_ABSTRACT_PROP)
                    .unwrap_or(false);
                let concrete = env
                    .is_property_true(&cond.properties, CONDITION_CONCRETE_PROP)
                    .unwrap_or(false);
                match entry_point {
                    DirectInterModule | DirectIntraModule | Indirect if concrete => false,
                    Verification if abstract_ => false,
                    DirectIntraModule => {
                        // For intra-module calls, all Requires and RequiresModule are visible.
                        // Ensures are only visible if the function is opaque.
                        match &cond.kind {
                            Requires | RequiresModule => true,
                            Ensures | AbortsIf | SucceedsIf => opaque || export_ensures,
                            _ => false,
                        }
                    }
                    DirectInterModule => {
                        // For inter-module calls, all exported Requires are visible. Ensures are
                        // only visible if the function is opaque and the condition is exported
                        match &cond.kind {
                            Requires => self.is_exported(cond),
                            Ensures | AbortsIf | SucceedsIf => {
                                (opaque || export_ensures) && self.is_exported(cond)
                            }
                            _ => false,
                        }
                    }
                    Indirect => match &cond.kind {
                        // For indirect calls, only ensures is visible if the condition is
                        // opaque and exported.
                        Ensures | AbortsIf | SucceedsIf => {
                            (opaque || export_ensures) && self.is_exported(cond)
                        }
                        _ => false,
                    },
                    Verification => true,
                    _ => false,
                }
            })
            .collect_vec()
    }
/// A helper for filtering conditions based on function entry point and whether the
/// function is opaque or not.
A helper for filtering conditions based on function entry point and whether the
function is opaque or not.
A helper for filtering conditions based on function entry point and whether the function is opaque or not .
fn filter_conditions<'c>(
        &self,
        entry_point: FunctionEntryPoint,
        opaque: bool,
        export_ensures: bool,
        kinds: &[ConditionKind],
        conditions: &'c [Condition],
    ) -> Vec<&'c Condition> {
        use ConditionKind::*;
        use FunctionEntryPoint::*;
        conditions
            .iter()
            .filter(|cond| {
                if !kinds.contains(&cond.kind) {
                    return false;
                }
                let env = self.module_env().env;
                let abstract_ = env
                    .is_property_true(&cond.properties, CONDITION_ABSTRACT_PROP)
                    .unwrap_or(false);
                let concrete = env
                    .is_property_true(&cond.properties, CONDITION_CONCRETE_PROP)
                    .unwrap_or(false);
                match entry_point {
                    DirectInterModule | DirectIntraModule | Indirect if concrete => false,
                    Verification if abstract_ => false,
                    DirectIntraModule => {
                        // For intra-module calls, all Requires and RequiresModule are visible.
                        // Ensures are only visible if the function is opaque.
                        match &cond.kind {
                            Requires | RequiresModule => true,
                            Ensures | AbortsIf | SucceedsIf => opaque || export_ensures,
                            _ => false,
                        }
                    }
                    DirectInterModule => {
                        // For inter-module calls, all exported Requires are visible. Ensures are
                        // only visible if the function is opaque and the condition is exported
                        match &cond.kind {
                            Requires => self.is_exported(cond),
                            Ensures | AbortsIf | SucceedsIf => {
                                (opaque || export_ensures) && self.is_exported(cond)
                            }
                            _ => false,
                        }
                    }
                    Indirect => match &cond.kind {
                        // For indirect calls, only ensures is visible if the condition is
                        // opaque and exported.
                        Ensures | AbortsIf | SucceedsIf => {
                            (opaque || export_ensures) && self.is_exported(cond)
                        }
                        _ => false,
                    },
                    Verification => true,
                    _ => false,
                }
            })
            .collect_vec()
    }
fn filter_conditions < ' c > ( & self , entry_point : FunctionEntryPoint , opaque : bool , export_ensures : bool , kinds : & [ ConditionKind ] , conditions : & ' c [ Condition ] , ) -> Vec < & ' c Condition > { use ConditionKind :: * ; use FunctionEntryPoint :: * ; conditions . iter ( ) . filter ( | cond | { if ! kinds . contains ( & cond . kind ) { return false ; } let env = self . module_env ( ) . env ; let abstract_ = env . is_property_true ( & cond . properties , CONDITION_ABSTRACT_PROP ) . unwrap_or ( false ) ; let concrete = env . is_property_true ( & cond . properties , CONDITION_CONCRETE_PROP ) . unwrap_or ( false ) ; match entry_point { DirectInterModule | DirectIntraModule | Indirect if concrete => false , Verification if abstract_ => false , DirectIntraModule => { // For intra-module calls, all Requires and RequiresModule are visible. // Ensures are only visible if the function is opaque. match & cond . kind { Requires | RequiresModule => true , Ensures | AbortsIf | SucceedsIf => opaque || export_ensures , _ => false , } } DirectInterModule => { // For inter-module calls, all exported Requires are visible. Ensures are // only visible if the function is opaque and the condition is exported match & cond . kind { Requires => self . is_exported ( cond ) , Ensures | AbortsIf | SucceedsIf => { ( opaque || export_ensures ) && self . is_exported ( cond ) } _ => false , } } Indirect => match & cond . kind { // For indirect calls, only ensures is visible if the condition is // opaque and exported. Ensures | AbortsIf | SucceedsIf => { ( opaque || export_ensures ) && self . is_exported ( cond ) } _ => false , } , Verification => true , _ => false , } } ) . collect_vec ( ) }
A helper for filtering conditions based on function entry point and whether the
function is opaque or not.
A helper for filtering conditions based on function entry point and whether the function is opaque or not .
&self
entry_point
FunctionEntryPoint
opaque
bool
export_ensures
bool
kinds
&[ConditionKind]
conditions
&'c [Condition]
&self
entry_point
FunctionEntryPoint
opaque
bool
export_ensures
bool
kinds
&[ConditionKind]
conditions
&'c [Condition]