pub(crate) enum BorrowExplanation<'tcx> {
UsedLater(LaterUseKind, Span, Option<Span>),
UsedLaterInLoop(LaterUseKind, Span, Option<Span>),
UsedLaterWhenDropped {
drop_loc: Location,
dropped_local: Local,
should_note_order: bool,
},
MustBeValidFor {
category: ConstraintCategory<'tcx>,
from_closure: bool,
span: Span,
region_name: RegionName,
opt_place_desc: Option<String>,
extra_info: Vec<ExtraConstraintInfo>,
},
Unexplained,
}
Variants§
UsedLater(LaterUseKind, Span, Option<Span>)
UsedLaterInLoop(LaterUseKind, Span, Option<Span>)
UsedLaterWhenDropped
MustBeValidFor
Fields
§
category: ConstraintCategory<'tcx>
§
region_name: RegionName
§
extra_info: Vec<ExtraConstraintInfo>
Unexplained
Implementations§
source§impl<'tcx> BorrowExplanation<'tcx>
impl<'tcx> BorrowExplanation<'tcx>
pub(crate) fn is_explained(&self) -> bool
pub(crate) fn add_explanation_to_diagnostic(
&self,
tcx: TyCtxt<'tcx>,
body: &Body<'tcx>,
local_names: &IndexVec<Local, Option<Symbol>>,
err: &mut Diagnostic,
borrow_desc: &str,
borrow_span: Option<Span>,
multiple_borrow_span: Option<(Span, Span)>
)
fn add_lifetime_bound_suggestion_to_diagnostic(
&self,
err: &mut Diagnostic,
category: &ConstraintCategory<'tcx>,
span: Span,
region_name: &RegionName
)
Trait Implementations§
Auto Trait Implementations§
impl<'tcx> !RefUnwindSafe for BorrowExplanation<'tcx>
impl<'tcx> !Send for BorrowExplanation<'tcx>
impl<'tcx> !Sync for BorrowExplanation<'tcx>
impl<'tcx> Unpin for BorrowExplanation<'tcx>
impl<'tcx> !UnwindSafe for BorrowExplanation<'tcx>
Blanket Implementations§
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 152 bytes
Size for each variant:
UsedLater
: 24 bytesUsedLaterInLoop
: 24 bytesUsedLaterWhenDropped
: 24 bytesMustBeValidFor
: 152 bytesUnexplained
: 0 bytes