Module macros
Source - impl_hir_node 🔒
- FormatArgsStorage
- Stores AST
FormatArgs
nodes for use in late lint passes, as they are in a desugared form in
the HIR - MacroCall
- A macro call, like
vec![1, 2, 3]
.
- FormatParamUsage
- Where a format parameter is being used in the format string
- PanicExpn
- FORMAT_MACRO_DIAG_ITEMS 🔒
- HirNode
- A node with a
HirId
and a Span
- expn_backtrace
- Returns an iterator of expansions that created the given span
- expn_is_local
- Checks whether the expansion is the root expansion or a locally defined macro
- find_assert_args
- Finds the arguments of an
assert!
or debug_assert!
macro call within the macro expansion - find_assert_args_inner 🔒
- find_assert_eq_args
- Finds the arguments of an
assert_eq!
or debug_assert_eq!
macro call within the macro
expansion - find_assert_within_debug_assert 🔒
- find_format_arg_expr
- Attempt to find the
rustc_hir::Expr
that corresponds to the FormatArgument
’s value - first_node_in_macro
- If
node
is the “first node” in a macro expansion, returns Some
with the ExpnId
of the
macro call site (i.e. the parent of the macro expansion). - first_node_macro_backtrace
- Like
macro_backtrace
, but only returns macro calls where node
is the “first node” of the
macro call, as in first_node_in_macro
. - format_arg_removal_span
- Returns the
Span
of the value at index
extended to the previous comma, e.g. for the value
10
- format_args_inputs_span
- Span covering the format string and values
- format_placeholder_format_span
- Span of the
:
and format specifiers - is_assert_arg 🔒
- is_assert_macro
- Is
def_id
of assert!
or debug_assert!
- is_format_macro
- Returns true if a given Macro
DefId
is a format macro (e.g. println!
) - is_panic
- Is
def_id
of std::panic
, core::panic
or any inner implementation macros - macro_backtrace
- Returns an iterator of macro expansions that created the given span.
Note that desugaring expansions are skipped.
- matching_root_macro_call
- A combination of
root_macro_call
and
is_diagnostic_item
that returns a MacroCall
at the root expansion if only it matches the given name. - root_macro_call
- If the macro backtrace of
span
has a macro call at the root expansion
(i.e. not a nested macro call), returns Some
with the MacroCall
- root_macro_call_first_node
- Like
root_macro_call
, but only returns Some
if node
is the “first node”
produced by the macro call, as in first_node_in_macro
. - span_is_local
- Checks whether the span is from the root expansion or a locally defined macro