Source positions and related helper functions.
Important concepts in this module include:
- the span, represented by
SpanDataand related types;
- source code as represented by a
- interned strings, represented by
Symbols, with some common symbols available statically in the
Unlike most compilers, the span contains not only the position in the source code, but also various other metadata,
such as the edition and macro hygiene. This metadata is stored in
This API is completely unstable and subject to change.
pub use hygiene::DesugaringKind;
pub use hygiene::ExpnKind;
pub use hygiene::ForLoopLoc;
pub use hygiene::MacroKind;
pub use hygiene::ExpnData;
pub use hygiene::ExpnHash;
pub use hygiene::ExpnId;
pub use hygiene::LocalExpnId;
pub use hygiene::SyntaxContext;
pub use symbol::sym;
pub use symbol::Symbol;
Machinery for hygienic macros.
Types for tracking pieces of source code within a crate.
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.
A byte offset.
A character offset.
Range inside of a
Span used for diagnostics when we only have access to relative positions.
A source code location used for error reporting.
Identifies an offset of a multi-byte character in a
A collection of
Identifies an offset of a character that was normalized away from
A single source in the
The hash of the on-disk source file used for debug info.
A compressed span.
Represents a span.
A span together with some additional data.
The state of the lazy external source loading mechanism of a
Differentiates between real files and common virtual files.
Identifies an offset of a non-narrow character in a
Dummy span, both position and length are zero, syntax context is zero as well.
\n in-place in
Normalizes the source code and records the normalizations.
Removes UTF-8 BOM, if any.
Calls the provided closure, using the provided
SourceMap to format
any spans that are debug-printed during the closure’s execution.