An AST literal.
The original literal token as written in source code.
The “semantic” representation of the literal lowered from the original tokens. Strings are unescaped, hexadecimal forms are eliminated, etc. FIXME: Remove this and only create the semantic representation during lowering to HIR.
Converts literal token into an AST literal.
Converts arbitrary token into an AST literal.
Keep this in sync with
Token::can_begin_literal_or_bool excluding unary negation.
Attempts to recover an AST literal from semantic literal. This function is used when the original token doesn’t exist (e.g. the literal is created by an AST-based macro) or unavailable (e.g. from HIR pretty-printing).
Losslessly convert an AST literal into a token.
Returns the argument unchanged.
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain
repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 48 bytes