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

Fields

§drop_loc: Location
§dropped_local: Local
§should_note_order: bool
§

MustBeValidFor

Fields

§category: ConstraintCategory<'tcx>
§from_closure: bool
§span: Span
§region_name: RegionName
§opt_place_desc: Option<String>
§

Unexplained

Implementations§

source§

impl<'tcx> BorrowExplanation<'tcx>

source

pub(crate) fn is_explained(&self) -> bool

source

pub(crate) fn add_explanation_to_diagnostic( &self, tcx: TyCtxt<'tcx>, body: &Body<'tcx>, local_names: &IndexSlice<Local, Option<Symbol>>, err: &mut Diagnostic, borrow_desc: &str, borrow_span: Option<Span>, multiple_borrow_span: Option<(Span, Span)> )

source

fn add_lifetime_bound_suggestion_to_diagnostic( &self, err: &mut Diagnostic, category: &ConstraintCategory<'tcx>, span: Span, region_name: &RegionName )

Trait Implementations§

source§

impl<'tcx> Debug for BorrowExplanation<'tcx>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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§

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.

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: 144 bytes

Size for each variant:

  • UsedLater: 28 bytes
  • UsedLaterInLoop: 28 bytes
  • UsedLaterWhenDropped: 32 bytes
  • MustBeValidFor: 144 bytes
  • Unexplained: 0 bytes