[][src]Module fast_rustc_ap_rustc_span::symbol

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.

Modules

kw
sym

Structs

Ident
IdentPrinter

This is the most general way to print identifiers. AST pretty-printer is used as a fallback for turning AST structures into token streams for proc macros. Additionally, proc macros may stringify their input and expect it survive the stringification (especially true for proc macro derives written between Rust 1.15 and 1.30). So we need to somehow pretty-print $crate in a way preserving at least some of its hygiene data, most importantly name of the crate it refers to. As a result we print $crate as crate if it refers to the local crate and as ::other_crate_name if it refers to some other crate. Note, that this is only done if the ident token is printed from inside of AST pretty-pringing, but not otherwise. Pretty-printing is the only way for proc macros to discover token contents, so we should not perform this lossy conversion if the top level call to the pretty-printer was done for a token stream or a single token.

Interner
Symbol

An interned string.

SymbolIndex
SymbolStr

An alternative to Symbol, useful when the chars within the symbol need to be accessed. It deliberately has limited functionality and should only be used for temporary values.