Enum rustc_borrowck::diagnostics::UseSpans
source · 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
sourceimpl UseSpans<'_>
impl UseSpans<'_>
pub(crate) fn args_or_use(self) -> Span
sourcepub(crate) fn var_or_use_path_span(self) -> Span
pub(crate) fn var_or_use_path_span(self) -> Span
Returns the span of self
, in the case of a ClosureUse
returns the path_span
sourcepub(crate) fn var_or_use(self) -> Span
pub(crate) fn var_or_use(self) -> Span
Returns the span of self
, in the case of a ClosureUse
returns the capture_kind_span
pub(crate) fn generator_kind(self) -> Option<GeneratorKind>
pub(crate) fn args_span_label(
self,
err: &mut Diagnostic,
message: impl Into<String>
)
pub(crate) fn var_span_label_path_only(
self,
err: &mut Diagnostic,
message: impl Into<String>
)
pub(crate) fn var_span_label(
self,
err: &mut Diagnostic,
message: impl Into<String>,
kind_desc: impl Into<String>
)
sourcepub(crate) fn for_closure(&self) -> bool
pub(crate) fn for_closure(&self) -> bool
Returns false
if this place is not used in a closure.
sourcepub(crate) fn for_generator(&self) -> bool
pub(crate) fn for_generator(&self) -> bool
Returns false
if this place is not used in a generator.
pub(crate) fn or_else<F>(self, if_other: F) -> Selfwhere
F: FnOnce() -> Self,
Trait Implementations
sourceimpl<'tcx> PartialEq<UseSpans<'tcx>> for UseSpans<'tcx>
impl<'tcx> PartialEq<UseSpans<'tcx>> for UseSpans<'tcx>
impl<'tcx> Copy for UseSpans<'tcx>
impl<'tcx> Eq for UseSpans<'tcx>
impl<'tcx> StructuralEq for UseSpans<'tcx>
impl<'tcx> StructuralPartialEq for UseSpans<'tcx>
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
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 bytesFnSelfUse
: 56 bytesPatUse
: 12 bytesOtherUse
: 12 bytes