Constructs a new identifier from a symbol and a span.
Constructs a new identifier with a dummy span.
Maps a string to an identifier with a dummy span.
Maps a string and a span to an identifier.
hi with those from
span, but keep hygiene context.
“Normalize” ident for use in comparisons using “item hygiene”.
Identifiers with same string value become same if they came from the same macro 2.0 macro
macro item, but not
macro_rules item) and stay different if they came from
different macro 2.0 macros.
Technically, this operation strips all non-opaque marks from ident’s syntactic context.
“Normalize” ident for use in comparisons using “local variable hygiene”.
Identifiers with same string value become same if they came from the same non-transparent
macro_rules! items) and stay different if they came from different
Technically, this operation strips all transparent marks from ident’s syntactic context.
Access the underlying string. This is a slowish operation because it requires locking the symbol interner.
Note that the lifetime of the return value is a lie. See
Symbol::as_str() for details.
true for reserved identifiers used internally for elided lifetimes,
unnamed method parameters, crate root module, error recovery etc.
true if the token is a keyword used in the language.
true if the token is a keyword reserved for possible future use.
true if the token is either a special identifier or a keyword.
A keyword or reserved identifier that can be used as a path segment.
We see this identifier in a normal identifier position, like variable name or a type. How was it written originally? Did it use the raw form? Let’s try to guess.
This implementation is supposed to be used in error messages, so it’s expected to be identical
to printing the original identifier token written in source code (
except that AST identifiers don’t keep the rawness flag, so we have to guess it.
Auto Trait Implementations§
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: 12 bytes