aboutsummaryrefslogtreecommitdiffstats
path: root/rust/macros/export.rs
diff options
context:
space:
mode:
authorAlice Ryhl <[email protected]>2025-03-03 08:45:13 +0000
committerMiguel Ojeda <[email protected]>2025-03-09 19:52:46 +0000
commit85525eda4f13c496defc46712348fe0711a59b2b (patch)
treecf3962a22b8fb10a084c24d29b434b740d559672 /rust/macros/export.rs
parentrust: fix signature of rust_fmt_argument (diff)
downloadkernel-85525eda4f13c496defc46712348fe0711a59b2b.tar.gz
kernel-85525eda4f13c496defc46712348fe0711a59b2b.zip
rust: macros: support additional tokens in quote!
This gives the quote! macro support for the following additional tokens: * The = token. * The _ token. * The # token. (when not followed by an identifier) * Using #my_var with variables of type Ident. Additionally, some type annotations are added to allow cases where groups are empty. For example, quote! does support () in the input, but only when it is *not* empty. When it is empty, there are zero `.push` calls, so the compiler can't infer the item type and also emits a warning about it not needing to be mutable. These additional quote! features are used by a new proc macro that generates code looking like this: const _: () = { if true { ::kernel::bindings::#name } else { #name }; }; where #name has type Ident. Reviewed-by: Andreas Hindborg <[email protected]> Reviewed-by: Tamir Duberstein <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Alice Ryhl <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
Diffstat (limited to 'rust/macros/export.rs')
0 files changed, 0 insertions, 0 deletions