1
Fork 0

Rollup merge of #95761 - c410-f3r:meta-var-stuff, r=petrochenkov

Kickstart the inner usage of `macro_metavar_expr`

There can be more use-cases but I am out of ideas.

cc #83527
r? ``@petrochenkov``
This commit is contained in:
Dylan DPC 2022-04-08 11:48:24 +02:00 committed by GitHub
commit 1f80881a94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 120 deletions

View file

@ -83,9 +83,7 @@ macro_rules! ast_fragments {
}
match self {
$($(AstFragment::$Kind(ast) => ast.extend(placeholders.iter().flat_map(|id| {
// We are repeating through arguments with `many`, to do that we have to
// mention some macro variable from those arguments even if it's not used.
macro _repeating($flat_map_ast_elt) {}
${ignore(flat_map_ast_elt)}
placeholder(AstFragmentKind::$Kind, *id, None).$make_ast()
})),)?)*
_ => panic!("unexpected AST fragment kind")

View file

@ -1,3 +1,4 @@
#![allow(rustc::potential_query_instability)]
#![feature(associated_type_bounds)]
#![feature(associated_type_defaults)]
#![feature(crate_visibility_modifier)]
@ -5,12 +6,12 @@
#![feature(if_let_guard)]
#![feature(let_chains)]
#![feature(let_else)]
#![feature(macro_metavar_expr)]
#![feature(proc_macro_diagnostic)]
#![feature(proc_macro_internals)]
#![feature(proc_macro_span)]
#![feature(try_blocks)]
#![recursion_limit = "256"]
#![allow(rustc::potential_query_instability)]
#[macro_use]
extern crate rustc_macros;