pub struct BorrowAnalysis {
pub liveness: LivenessResult,
pub loans_at_point: HashMap<Point, Vec<LoanId>>,
pub loans: HashMap<LoanId, LoanInfo>,
pub errors: Vec<BorrowError>,
pub ownership_decisions: HashMap<Point, OwnershipDecision>,
pub mutability_errors: Vec<MutabilityError>,
pub return_reference_summary: Option<ReturnReferenceSummary>,
}Expand description
The complete borrow analysis for a single function. Produced by the Datafrog solver + liveness analysis. Consumed (read-only) by compiler, LSP, and diagnostics.
Fields§
§liveness: LivenessResultLiveness results for move/clone decisions.
loans_at_point: HashMap<Point, Vec<LoanId>>Active loans at each program point (from Datafrog solver).
loans: HashMap<LoanId, LoanInfo>Loan metadata.
errors: Vec<BorrowError>Borrow errors detected by the solver.
ownership_decisions: HashMap<Point, OwnershipDecision>Move/clone decisions for each assignment of a non-Copy type.
mutability_errors: Vec<MutabilityError>Immutability violations (writing to immutable bindings).
return_reference_summary: Option<ReturnReferenceSummary>If this function safely returns one reference parameter (possibly with a projection), records which parameter flows out and whether it is shared/exclusive.
Implementations§
Source§impl BorrowAnalysis
impl BorrowAnalysis
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Check if the analysis found any errors.
Sourcepub fn ownership_at(&self, point: Point) -> OwnershipDecision
pub fn ownership_at(&self, point: Point) -> OwnershipDecision
Get the ownership decision for a given point. Returns Copy for primitive types.
Sourcepub fn active_loans_at(&self, point: Point) -> &[LoanId]
pub fn active_loans_at(&self, point: Point) -> &[LoanId]
Get all active loans at a given point (for LSP borrow windows).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BorrowAnalysis
impl RefUnwindSafe for BorrowAnalysis
impl Send for BorrowAnalysis
impl Sync for BorrowAnalysis
impl Unpin for BorrowAnalysis
impl UnsafeUnpin for BorrowAnalysis
impl UnwindSafe for BorrowAnalysis
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more