MCPcopy Create free account
hub / github.com/Rust-API/Rust-API-Bypass-Checker / implies

Method implies

src/analysis/memory/symbolic_value.rs:877–894  ·  view source on GitHub ↗

Returns true if "self => other" is known at compile time to be true. Returning false does not imply the implication is false, just that we do not know. Important: keep the performance of this function proportional to the size of self.

(&self, other: &Rc<SymbolicValue>)

Source from the content-addressed store, hash-verified

875 ///
876 /// Important: keep the performance of this function proportional to the size of self.
877 fn implies(&self, other: &Rc<SymbolicValue>) -> bool {
878 // x => true, is always true
879 // false => x, is always true
880 // x => x, is always true
881 if other.as_bool_if_known().unwrap_or(false)
882 || !self.as_bool_if_known().unwrap_or(true)
883 || self.eq(other)
884 {
885 return true;
886 }
887
888 // x && y => x
889 // y && x => x
890 if let Expression::And { left, right } = &self.expression {
891 return left.implies(other) || right.implies(other);
892 }
893 false
894 }
895
896 /// Returns true if "self => !other" is known at compile time to be true.
897 /// Returning false does not imply the implication is false, just that we do not know.

Callers 2

inverse_impliesMethod · 0.80
refine_withMethod · 0.80

Calls 2

as_bool_if_knownMethod · 0.45
eqMethod · 0.45

Tested by

no test coverage detected