pub struct PermissionsCtxt<'a, 'tcx> {
    pub tcx: TyCtxt<'tcx>,
    pub polonius_input_facts: &'a AllFacts<RustcFacts>,
    pub polonius_output: Output<RustcFacts>,
    pub permissions_output: Output<AquascopeFacts>,
    pub body_id: BodyId,
    pub def_id: DefId,
    pub body_with_facts: &'a BodyWithBorrowckFacts<'tcx>,
    pub borrow_set: BorrowSet<'tcx>,
    pub move_data: MoveData<'tcx>,
    pub loan_regions: Option<FxHashMap<Loan, (Point, Point)>>,
    pub locals_are_invalidated_at_exit: bool,
    /* private fields */
}

Fields§

§tcx: TyCtxt<'tcx>§polonius_input_facts: &'a AllFacts<RustcFacts>§polonius_output: Output<RustcFacts>§permissions_output: Output<AquascopeFacts>

Program facts unique to Aquascope.

These are generated by the Output builder and overlap quite a bit with the [rustc_borrowck::consumers::RustcFacts], however, unlike rustc we maintain data about all Places in a body (plus some other things). Conversion functions between the two sets of facts are provided by the PermissionsCtxt.

§body_id: BodyId§def_id: DefId§body_with_facts: &'a BodyWithBorrowckFacts<'tcx>§borrow_set: BorrowSet<'tcx>§move_data: MoveData<'tcx>§loan_regions: Option<FxHashMap<Loan, (Point, Point)>>§locals_are_invalidated_at_exit: bool

Implementations§

source§

impl<'a, 'tcx> PermissionsCtxt<'a, 'tcx>

source

pub fn new_path(&mut self, place: Place<'tcx>) -> Path

source

pub fn region_flows(&self) -> &RegionFlows

source

pub fn place_to_path(&self, p: &Place<'tcx>) -> Path

Convert and normalize a rustc Place into a Path understood by Aquascope.

source

pub fn path_to_place(&self, p: Path) -> Place<'tcx>

source

pub fn location_to_point(&self, l: Location) -> Point

source

pub fn location_to_points(&self, l: Location) -> SmallVec<[Point; 2]>

source

pub fn point_to_location(&self, p: Point) -> Location

source

pub fn path_to_moveable_path(&self, p: Path) -> <RustcFacts as FactTypes>::Path

source

pub fn moveable_path_to_path(&self, mp: <RustcFacts as FactTypes>::Path) -> Path

source

pub fn path_to_variable(&self, path: Path) -> Variable

source

pub fn location_to_span(&self, l: Location) -> Span

source

pub fn move_to_moveable_path(&self, mv: Move) -> <RustcFacts as FactTypes>::Path

source

pub fn move_to_path(&self, mv: Move) -> Path

source

pub fn loan_to_borrow(&self, l: Loan) -> &BorrowData<'tcx>

source

pub fn is_universal_subset(&self, (from, to): (Origin, Origin)) -> bool

source

pub fn is_location_operational(&self, loc: Location) -> bool

source

pub fn is_point_operational(&self, point: Point) -> bool

source

pub fn is_mutable_borrow(&self, brw: &BorrowData<'tcx>) -> bool

source

pub fn is_mutable_loan(&self, loan: Loan) -> bool

source

pub fn is_declared_readonly(&self, place: &Place<'tcx>) -> bool

source

pub fn is_path_live_at(&self, path: Path, point: Point) -> bool

source

pub fn is_path_copyable(&self, path: Path) -> bool

On use would the given path be copied?

source

pub fn is_path_write_enabled(&self, path: Path) -> bool

Can this path be written to?

source

pub fn is_path_drop_enabled(&self, path: Path) -> bool

Does a Path’s type allow it to be dropped? NOTE: the utility is the negation of the datalog rule.

.decl never_drop(Path)

never_drop(Path) :- !is_direct(Path), !is_index(Path), has_adt_prefix_with_dtor(Path).

This logic follows from Rust’s [MoveData::gather_moves] builder, the core logic is found here: https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_mir_dataflow/move_paths/builder.rs.html#100

source

pub fn max_permissions(&self, path: Path) -> Permissions

The maximum set of permissions a given Path could have at any point.

source

pub fn permissions_for_const_ty(&self, ty: Ty<'tcx>) -> PermissionsData

source

pub fn permissions_data_at_point( &self, path: Path, point: Point ) -> PermissionsData

Compute the PermissionsData for the Path at Point.

The PermissionsData holds destructured permissions info about a Place. This info remains desugared to help with visual marks but the set of existing Permissions is computed. Permissions are given by the following rules:

decl read(Path, Point)
decl write(Path, Point)
decl drop(Path, Point)
decl memory_uninitialized(Path, Point)

memory_uninitialized(Path, Point) :-
  path_moved(Path, Point).
memory_uninitialized(Path, Point) :-
  path_uninitialized(Path, Point).

read(Path, Point) :-
  !memory_uninitialized(Point),
  !loan_read_refined(Path, Point).

write(Path, Point) :-
  path_ty_allows_write(Path),
  read(Path, Point),
  !loan_write_refined(Path, Point).


drop(Path, Point) :-
  path_ty_allows_drop(Path),
  read(Path, Point),
  !loan_drop_refined(Path, Point).

Queries not defined in the

source

pub fn domain_places(&self) -> HashSet<Place<'tcx>>

source

pub fn domain_bottom(&self) -> PermissionsDomain<'tcx>

source

pub fn permissions_domain_at_point( &self, point: Point ) -> PermissionsDomain<'tcx>

Auto Trait Implementations§

§

impl<'a, 'tcx> !RefUnwindSafe for PermissionsCtxt<'a, 'tcx>

§

impl<'a, 'tcx> !Send for PermissionsCtxt<'a, 'tcx>

§

impl<'a, 'tcx> !Sync for PermissionsCtxt<'a, 'tcx>

§

impl<'a, 'tcx> Unpin for PermissionsCtxt<'a, 'tcx>

§

impl<'a, 'tcx> !UnwindSafe for PermissionsCtxt<'a, 'tcx>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V