pub(crate) 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: CallKind<'tcx>,
    },
    PatUse(Span),
    OtherUse(Span),
}
Expand description

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

Variants

ClosureUse

Fields

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.

capture_kind_span: Span

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

path_span: Span

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

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

FnSelfUse

Fields

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: CallKind<'tcx>

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

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

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

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

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

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

Describe the span associated with a use of a place.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion 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: 56 bytes

Size for each variant:

  • ClosureUse: 32 bytes
  • FnSelfUse: 56 bytes
  • PatUse: 12 bytes
  • OtherUse: 12 bytes