[][src]Crate syntax

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

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

The Rust parser and macro expander.

Note

This API is completely unstable and subject to change.

Re-exports

pub extern crate rustc_errors as errors;

Modules

ast [
Experimental
]
attr [
Experimental
]

Functions dealing with attributes and meta items

config [
Experimental
]
diagnostic_list [
Experimental
]
diagnostics [
Experimental
]
early_buffered_lints [
Experimental
]

Allows the buffering of lints for later.

edition [
Experimental
]
entry [
Experimental
]
ext [
Experimental
]
feature_gate [
Experimental
]

Feature gating

fold [
Experimental
]

A Folder represents an AST->AST fold; it accepts an AST piece, and returns a piece of the same type. So, for instance, macro expansion is a Folder that walks over an AST and produces another AST.

json [
Experimental
]

A JSON emitter for errors.

parse [
Experimental
]

The main parser interface

print [
Experimental
]
ptr [
Experimental
]

The AST pointer

show_span [
Experimental
]

Span debugger

source_map [
Experimental
]

The SourceMap 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 SourceMap and are represented by SourceFiles. Byte positions are stored in spans and used pervasively in the compiler. They are absolute positions within the SourceMap, which upon request can be converted to line and column information, source code snippets, etc.

std_inject [
Experimental
]
str [
Experimental
]
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.

syntax [
Experimental
]
test [
Experimental
]
tokenstream [
Experimental
]

Token Streams

util [
Experimental
]
visit [
Experimental
]

AST walker. Each overridden visit method has full control over what happens with its node, it can do its own traversal of the node's children, call visit::walk_* to apply the default traversal algorithm, or prevent deeper traversal by doing nothing.

Macros

help [
Experimental
]
panictry [
Experimental
]
register_diagnostic [
Experimental
]
register_diagnostics [
Experimental
]
register_long_diagnostics [
Experimental
]
span_err [
Experimental
]
span_err_or_warn [
Experimental
]
span_fatal [
Experimental
]
span_help [
Experimental
]
span_note [
Experimental
]
span_warn [
Experimental
]
stringify_error_code [
Experimental
]
struct_err [
Experimental
]
struct_span_err [
Experimental
]
struct_span_err_or_warn [
Experimental
]
struct_span_fatal [
Experimental
]
struct_span_warn [
Experimental
]
type_error_struct [
Experimental
]
unwrap_or [
Experimental
]
walk_list [
Experimental
]

Structs

Globals [
Experimental
]
ThinVec [
Experimental
]

A vector type optimized for cases where this size is usually 0 (c.f. SmallVector). The Option<Box<..>> wrapping allows us to represent a zero sized vector with None, which uses only a single (null) pointer.

Constants

DIAGNOSTICS [
Experimental
]

Statics

GLOBALS [
Experimental
]

Functions

with_globals [
Experimental
]

Type Definitions

OneVector [
Experimental
]