Enum rustc_borrowck::diagnostics::UseSpans [−][src]
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: FnSelfUseKind<'tcx>,
},
PatUse(Span),
OtherUse(Span),
}
Expand description
The span(s) associated to a use of a place.
Variants
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.
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 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.
Tuple Fields of PatUse
0: Span
OtherUse(Span)
This access has a single span associated to it: common case.
Tuple Fields of OtherUse
0: Span
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
pub(crate) fn args_span_label(
self,
err: &mut DiagnosticBuilder<'_>,
message: impl Into<String>
)
pub(crate) fn var_span_label_path_only(
self,
err: &mut DiagnosticBuilder<'_>,
message: impl Into<String>
)
pub(crate) fn var_span_label(
self,
err: &mut DiagnosticBuilder<'_>,
message: impl Into<String>,
kind_desc: impl Into<String>
)
Returns false
if this place is not used in a closure.
Returns false
if this place is not used in a generator.
Trait Implementations
Auto Trait Implementations
impl<'tcx> !RefUnwindSafe for UseSpans<'tcx>
impl<'tcx> !UnwindSafe for UseSpans<'tcx>
Blanket Implementations
Mutably borrows from an owned value. Read more
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
: 27 bytesFnSelfUse
: 55 bytesPatUse
: 11 bytesOtherUse
: 11 bytes