Crate syntax_pos [] [src]

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, and unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

The source positions and related helper functions

Note

This API is completely unstable and subject to change.

Reexports

pub use hygiene::SyntaxContext;
pub use hygiene::ExpnInfo;
pub use hygiene::ExpnFormat;
pub use hygiene::NameAndSpan;

Modules

hygiene [
Experimental
]

Machinery for hygienic macros, inspired by the MTWT[1] paper.

symbol [
Experimental
]

An "interner" is a data structure that associates values with usize tags and allows bidirectional lookup; i.e. given a value, one can easily find the type, and vice versa.

Structs

BytePos [
Experimental
]

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

CharPos [
Experimental
]

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.

DistinctSources [
Experimental
]
FileLines [
Experimental
]
FileMap [
Experimental
]

A single source in the CodeMap.

FileMapAndBytePos [
Experimental
]
FileMapAndLine [
Experimental
]
LineInfo [
Experimental
]
Loc [
Experimental
]

A source code location used for error reporting

LocWithOpt [
Experimental
]

A source code location used as the result of lookup_char_pos_adj

MacroBacktrace [
Experimental
]
MalformedCodemapPositions [
Experimental
]
MultiByteChar [
Experimental
]

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

MultiSpan [
Experimental
]

A collection of spans. Spans have two orthogonal attributes:

Span [
Experimental
]

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. You must be careful if the span crosses more than one file - you will not be able to use many of the functions on spans in codemap and you cannot assume that the length of the span = hi - lo; there may be space in the BytePos range between files.

SpanLabel [
Experimental
]

Enums

ExternalSource [
Experimental
]

The state of the lazy external source loading mechanism of a FileMap.

SpanLinesError [
Experimental
]
SpanSnippetError [
Experimental
]

Constants

DUMMY_SP [
Experimental
]
NO_EXPANSION [
Experimental
]

Statics

SPAN_DEBUG [
Experimental
]

Traits

Pos [
Experimental
]

Type Definitions

FileLinesResult [
Experimental
]
FileName [
Experimental
]