Expr in rustc_ast::ast - Rust (original) (raw)
pub struct Expr {
pub id: NodeId,
pub kind: ExprKind,
pub span: Span,
pub attrs: AttrVec,
pub tokens: Option<LazyAttrTokenStream>,
}
Expand description
An expression.
Check if this expression is potentially a trivial const arg, i.e., one that can _potentially_be represented without an anon const in the HIR.
This will unwrap at most one block level (curly braces). After that, if the expression is a path, it mostly dispatches to Path::is_potential_trivial_const_arg. See there for more info about allow_mgca_arg
.
The only additional thing to note is that when allow_mgca_arg
is false, this function will only allow paths with no qself, before dispatching to the Path
function of the same name.
Does not ensure that the path resolves to a const param/item, the caller should check this. This also does not consider macros, so it’s only correct after macro-expansion.
Returns an expression with (when possible) one outter brace removed
Determines whether this expression is a macro call optionally wrapped in braces . Ifalready_stripped_block
is set then we do not attempt to peel off a layer of braces.
Returns the NodeId of the macro call and whether a layer of braces has been peeled either before, or part of, this function.
Attempts to reparse as Ty
(for diagnostic purposes).
To a first-order approximation, is this a pattern?
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: 72 bytes