[−][src]Enum rustc_mir::borrow_check::diagnostics::UseSpans

pub(in borrow_check) enum UseSpans<'tcx> {
    ClosureUse {
        generator_kind: Option<GeneratorKind>,
        args_span: Span,
        var_span: Span,
    },
    FnSelfUse {
        var_span: Span,
        fn_call_span: Span,
        fn_span: Span,
        kind: FnSelfUseKind<'tcx>,
    },
    PatUse(Span),
    OtherUse(Span),
}

The span(s) associated to a use of a place.

Variants

ClosureUse

The access is caused by capturing a variable for a closure.

Fields of ClosureUse

generator_kind: Option<GeneratorKind>

This is true if the captured variable was from a generator.

args_span: Span

The span of the args of the closure, including the move keyword if it's present.

var_span: Span

The span of the first use of the captured variable inside the closure.

FnSelfUse

The access is caused by using a variable as the receiver of a method that takes 'self'

Fields of FnSelfUse

var_span: Span

The span of the variable being moved

fn_call_span: Span

The span of the method call on the variable

fn_span: Span

The definition span of the method being called

kind: FnSelfUseKind<'tcx>
PatUse(Span)

This access is caused by a match or if let pattern.

OtherUse(Span)

This access has a single span associated to it: common case.

Implementations

impl<'_> UseSpans<'_>[src]

pub(in borrow_check) fn args_or_use(
    self
) -> Span
[src]

pub(in borrow_check) fn var_or_use(
    self
) -> Span
[src]

pub(in borrow_check) fn generator_kind(
    self
) -> Option<GeneratorKind>
[src]

pub(in borrow_check) fn args_span_label(
    self,
    err: &mut DiagnosticBuilder<'_>,
    message: impl Into<String>
)
[src]

pub(in borrow_check) fn var_span_label(
    self,
    err: &mut DiagnosticBuilder<'_>,
    message: impl Into<String>
)
[src]

pub(in borrow_check) fn for_closure(
    &self
) -> bool
[src]

Returns false if this place is not used in a closure.

pub(in borrow_check) fn for_generator(
    &self
) -> bool
[src]

Returns false if this place is not used in a generator.

pub(in borrow_check) fn describe(
    &self
) -> String
[src]

Describe the span associated with a use of a place.

pub(in borrow_check) fn or_else<F>(
    self,
    if_other: F
) -> Self where
    F: FnOnce() -> Self, 
[src]

Trait Implementations

impl<'tcx> Clone for UseSpans<'tcx>[src]

impl<'tcx> Copy for UseSpans<'tcx>[src]

impl<'tcx> Debug for UseSpans<'tcx>[src]

impl<'tcx> Eq for UseSpans<'tcx>[src]

impl<'tcx> PartialEq<UseSpans<'tcx>> for UseSpans<'tcx>[src]

impl<'tcx> StructuralEq for UseSpans<'tcx>[src]

impl<'tcx> StructuralPartialEq for UseSpans<'tcx>[src]

Auto Trait Implementations

impl<'tcx> !RefUnwindSafe for UseSpans<'tcx>

impl<'tcx> !Send for UseSpans<'tcx>

impl<'tcx> !Sync for UseSpans<'tcx>

impl<'tcx> Unpin for UseSpans<'tcx>

impl<'tcx> !UnwindSafe for UseSpans<'tcx>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone, 
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> WithConstness for T[src]