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

pub(super) enum UseSpans<'tcx> {
    ClosureUse {
        generator_kind: Option<GeneratorKind>,
        args_span: Span,
        capture_kind_span: Span,
        path_span: Span,
    },
    FnSelfUse {
        var_span: Span,
        fn_call_span: Span,
        fn_span: Span,
        kind: FnSelfUseKind<'tcx>,
    },
    PatUse(Span),
    OtherUse(Span),
}
Expand description

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

Variants

ClosureUse
Expand description

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

Show fields

Fields of ClosureUse

generator_kind: Option<GeneratorKind>
Expand description

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

args_span: Span
Expand description

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

capture_kind_span: Span
Expand description

The span of the use resulting in capture kind Check ty::CaptureInfo for more details

path_span: Span
Expand description

The span of the use resulting in the captured path Check ty::CaptureInfo for more details

FnSelfUse
Expand description

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

Show fields

Fields of FnSelfUse

var_span: Span
Expand description

The span of the variable being moved

fn_call_span: Span
Expand description

The span of the method call on the variable

fn_span: Span
Expand description

The definition span of the method being called

kind: FnSelfUseKind<'tcx>
PatUse(Span)
Expand description

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

OtherUse(Span)
Expand description

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

Implementations

impl UseSpans<'_>[src]

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

pub(super) fn var_or_use_path_span(self) -> Span[src]

Returns the span of self, in the case of a ClosureUse returns the path_span

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

Returns the span of self, in the case of a ClosureUse returns the capture_kind_span

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

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

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

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

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

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

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

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

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

Describe the span associated with a use of a place.

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

Trait Implementations

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

fn clone(&self) -> UseSpans<'tcx>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

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

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

Formats the value using the given formatter. Read more

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

fn eq(&self, other: &UseSpans<'tcx>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &UseSpans<'tcx>) -> bool[src]

This method tests for !=.

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

impl<'tcx> Eq 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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

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

Performs the conversion.

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.

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

Performs the conversion.

impl<T> WithConstness for T[src]

fn with_constness(self, constness: Constness) -> ConstnessAnd<Self>[src]

fn with_const(self) -> ConstnessAnd<Self>[src]

fn without_const(self) -> ConstnessAnd<Self>[src]