[−][src]Struct c2rust_refactor::analysis::ownership::constraint::ConstraintSet
A set of constraints over permission expressions, of the form p1 <= p2
.
Note that most of the more complex operations are imprecise (unsound) in certain cases
involving Min
. Fortunately, these cases seem not to come up often in practice.
Methods
impl<'lty, 'tcx> ConstraintSet<'lty>
[src]
pub fn new() -> ConstraintSet<'lty>
[src]
pub fn iter(&self) -> Iter<(Perm<'lty>, Perm<'lty>)>
[src]
pub fn add(&mut self, a: Perm<'lty>, b: Perm<'lty>)
[src]
pub fn import(&mut self, other: &ConstraintSet<'lty>)
[src]
Add all constraints from other
to self
.
pub fn import_substituted<F>(
&mut self,
other: &ConstraintSet<'lty>,
arena: &'lty SyncDroplessArena,
f: F
) where
F: Fn(Perm<'lty>) -> Perm<'lty>,
[src]
&mut self,
other: &ConstraintSet<'lty>,
arena: &'lty SyncDroplessArena,
f: F
) where
F: Fn(Perm<'lty>) -> Perm<'lty>,
For each constraint in other
, substitute all atomic permissions using the callback f
,
then add the constraint to self
.
pub fn clone_substituted<F>(
&self,
arena: &'lty SyncDroplessArena,
f: F
) -> ConstraintSet<'lty> where
F: Fn(Perm<'lty>) -> Perm<'lty>,
[src]
&self,
arena: &'lty SyncDroplessArena,
f: F
) -> ConstraintSet<'lty> where
F: Fn(Perm<'lty>) -> Perm<'lty>,
Clone self
, substituting each atomic permission using the callback f
.
pub fn for_each_less_than<F>(&self, p: Perm<'lty>, f: F) where
F: FnMut(Perm<'lty>) -> bool,
[src]
F: FnMut(Perm<'lty>) -> bool,
Iterate over all permissions less than p
.
This only traverses chains of q <= p
, r <= q
, etc. It doesn't do anything intelligent
regarding Min
.
pub fn for_each_greater_than<F>(&self, p: Perm<'lty>, f: F) where
F: FnMut(Perm<'lty>) -> bool,
[src]
F: FnMut(Perm<'lty>) -> bool,
Iterate over all permissions greater than p
.
This only traverses chains of p <= q
, q <= r
, etc. It doesn't do anything intelligent
regarding Min
.
pub fn lower_bound(&self, p: Perm<'lty>) -> ConcretePerm
[src]
Obtain a concrete lower bound on p
. Replacing p
with any concrete permission less than
lower_bound(p)
is guaranteed to make the constraint set unsatisfiable.
This function may return a lower result than necessary due to imprecise reasoning about
Min
.
pub fn upper_bound(&self, p: Perm<'lty>) -> ConcretePerm
[src]
Obtain a concrete upper bound on p
. Replacing p
with any concrete permission greater
than upper_bound(p)
is guaranteed to make the constraint set unsatisfiable.
This function may return a higher result than necessary due to imprecise reasoning about
Min
.
pub fn check_partial_assignment<F>(&self, eval: F) -> bool where
F: Fn(Perm<'lty>) -> Option<ConcretePerm>,
[src]
F: Fn(Perm<'lty>) -> Option<ConcretePerm>,
Given an assignment of concrete permission values to a subset of the variables, check
whether any constraints are violated under the partial assignment. Returns false
if a
constraint is violated, or true
if all constraints appear to be satisfiable.
Note this function is only guaranteed to be accurate for complete assignments. On (strictly) partial assignments, it may report that a satisfying assignment is possible when it's not, but never the other way around.
pub fn edit<'a>(&'a mut self) -> EditConstraintSet<'a, 'lty>
[src]
Obtain an editing cursor for this constraint set.
pub fn for_each_perm<F: FnMut(Perm<'lty>)>(&self, f: F)
[src]
Iterate over each atomic permission in each constraint.
impl<'lty, 'tcx> ConstraintSet<'lty>
[src]
pub fn remove_useless(&mut self)
[src]
Remove constraints that are obviously useless, like READ <= p
.
pub fn expand_min_rhs(&mut self)
[src]
Simplify a <= min(b1, b2)
into a <= b1, a <= b2
.
pub fn simplify_min_lhs(&mut self, arena: &'lty SyncDroplessArena)
[src]
Simplify min(...) <= ...
constraints as much as possible. Unlike ... <= min(...)
, it
may not always be possible to completely eliminate such constraints.
pub fn simplify(&mut self, arena: &'lty SyncDroplessArena)
[src]
Simplify the constraint set as best we can.
pub fn retain_perms<F>(&mut self, arena: &'lty SyncDroplessArena, filter: F) where
F: Fn(Perm<'lty>) -> bool,
[src]
F: Fn(Perm<'lty>) -> bool,
Eliminate constraints involving permissions on which f(p)
returns false, while
maintaining relationships between other permissions. For example, when removing q
from
{p <= q, q <= r}
, we would add p <= r
before removing the other two constraints.
This may be imprecise if a removed permission appears as an argument of a Min
. Simplify
the constraint set first to remove as many Min
s as possible before using this function.
Trait Implementations
impl<'lty> Eq for ConstraintSet<'lty>
[src]
impl<'lty> PartialEq<ConstraintSet<'lty>> for ConstraintSet<'lty>
[src]
fn eq(&self, other: &ConstraintSet<'lty>) -> bool
[src]
fn ne(&self, other: &ConstraintSet<'lty>) -> bool
[src]
impl<'lty> Clone for ConstraintSet<'lty>
[src]
fn clone(&self) -> ConstraintSet<'lty>
[src]
default fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'lty> Debug for ConstraintSet<'lty>
[src]
Auto Trait Implementations
impl<'lty> Send for ConstraintSet<'lty>
impl<'lty> Sync for ConstraintSet<'lty>
Blanket Implementations
impl<T> Lone for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<E> SpecializationError for E
[src]
default fn not_found<S, T>(
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,
[src]
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,
impl<T> Erased for T
[src]
impl<T> Send for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Sync for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Same for T
type Output = T
Should always be Self
impl<Q, K> Equivalent for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> MaybeResult for T
[src]
impl<'a, T> Captures for T where
T: ?Sized,
[src]
T: ?Sized,