Extend rustdoc macro-generated-macro test

This commit is contained in:
David Tolnay 2022-01-08 12:39:47 -08:00
parent 9ad5d82f82
commit d950c1b200
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -1,14 +1,21 @@
macro_rules! outer {
($($matcher:tt)*) => {
macro_rules! make_macro {
($macro_name:ident $($matcher:tt)*) => {
#[macro_export]
macro_rules! inner {
macro_rules! $macro_name {
(<= $($matcher)* =>) => {};
}
}
}
// @has macro_generated_macro/macro.inner.html //pre 'macro_rules! inner {'
// @has macro_generated_macro/macro.interpolations.html //pre 'macro_rules! interpolations {'
// @has - //pre '(<= type $($i : ident) :: * + $e : expr =>) => { ... };'
outer!(type $($i:ident)::* + $e:expr);
make_macro!(interpolations type $($i:ident)::* + $e:expr);
interpolations!(<= type foo::bar + x.sort() =>);
inner!(<= type foo::bar + x.sort() =>);
// @has macro_generated_macro/macro.attributes.html //pre 'macro_rules! attributes {'
// @has - //pre '(<= #! [no_std] #[inline] =>) => { ... };'
make_macro!(attributes #![no_std] #[inline]);
// @has macro_generated_macro/macro.groups.html //pre 'macro_rules! groups {'
// @has - //pre '(<= fn {} () { foo [0] } =>) => { ... };'
make_macro!(groups fn {}() {foo[0]});