Module syntax::codemap [−] [src]

Unstable

The CodeMap tracks all the source code used within a single crate, mapping from integer byte positions to the original source code location. Each bit of source parsed during crate parsing (typically files, in-memory strings, or various bits of macro expansion) cover a continuous range of bytes in the CodeMap and are represented by FileMaps. Byte positions are stored in spans and used pervasively in the compiler. They are absolute positions within the CodeMap, which upon request can be converted to line and column information, source code snippets, etc.

Reexports

pub use self::ExpnFormat::*;

Structs

BytePos [Unstable]

A byte offset. Keep this small (currently 32-bits), as AST contains a lot of them.

CharPos [Unstable]

A character offset. Because of multibyte utf8 characters, a byte offset is not equivalent to a character offset. The CodeMap will convert BytePos values to CharPos values as necessary.

CodeMap [Unstable]
DistinctSources [Unstable]
ExpnId [Unstable]
ExpnInfo [Unstable]

Extra information for tracking spans of macro and syntax sugar expansion

FileLines [Unstable]
FileMap [Unstable]

A single source in the CodeMap

FileMapAndBytePos [Unstable]
FileMapAndLine [Unstable]
LineInfo [Unstable]
Loc [Unstable]

A source code location used for error reporting

LocWithOpt [Unstable]

A source code location used as the result of lookup_char_pos_adj

MalformedCodemapPositions [Unstable]
MultiByteChar [Unstable]

Identifies an offset of a multi-byte character in a FileMap

NameAndSpan [Unstable]
Span [Unstable]

Spans represent a region of code, used for error reporting. Positions in spans are absolute positions from the beginning of the codemap, not positions relative to FileMaps. Methods on the CodeMap can be used to relate spans back to the original source.

Spanned [Unstable]

Enums

ExpnFormat [Unstable]

The source of expansion.

SpanLinesError [Unstable]
SpanSnippetError [Unstable]

Constants

COMMAND_LINE_EXPN [Unstable]
COMMAND_LINE_SP [Unstable]
DUMMY_SP [Unstable]
NO_EXPANSION [Unstable]

Traits

Pos [Unstable]

Functions

dummy_spanned [Unstable]
mk_sp [Unstable]
original_sp [Unstable]

Return the span itself if it doesn't come from a macro expansion, otherwise return the call site span up to the enclosing_sp by following the expn_info chain.

respan [Unstable]
spanned [Unstable]

Type Definitions

FileLinesResult [Unstable]
FileName [Unstable]