Skip to main content

Module spans

Module spans 

Source

Modules§

pack 🔒
Bit layout of the packed representation of Span.

Structs§

File
FileId
Loc
SerializedSpan
A Span with its contents laid out, used for serialization and unpacking into a more readable format.
Span
A snippet of source code within a file, along with the place the code was generated from in case of macro expansion. This is a pair of the span itself (data) and an optional “generated from” span (generated_from_span).
SpanData
A snippet of source code within a file.
WideSpans 🔒

Enums§

FileName
A filename.

Statics§

WIDE_SPANS 🔒
The spans that don’t fit the packed representation of Span. We store them here once and refer to them by index. Entries are deduplicated so equal spans have equal representations.

Functions§

combine_span
Combine some span information (useful when we need to compute the span-information of, say, a sequence).
combine_span_iter
Combine all the span information in a slice.
line_to_start_byte 🔒
Given a line number within a source file, get the byte of the start of the line. Obviously not efficient to do many times, but this is used is diagnostic paths only. The line numer is expected to be 1-based.