@@ -250,36 +250,37 @@ pub fn _extract_input(derive_input: &str) -> &str {
250250macro_rules! define_invoke_proc_macro {
251251 ( $macro_name: ident) => {
252252 /// Implementation detail of other macros in this crate.
253+ #![ rustfmt:: skip]
253254 #[ doc( hidden) ]
254255 #[ macro_export]
255256 macro_rules! $macro_name {
256- ( $proc_macro_name: ident ! $paren: tt) => {
257- #[ derive( $proc_macro_name) ]
258- #[ allow( unused) ]
259- enum ProceduralMasqueradeDummyType {
260- // The magic happens here.
261- //
262- // We use an `enum` with an explicit discriminant
263- // because that is the only case where a type definition
264- // can contain a (const) expression.
265- //
266- // `(0, "foo").0` evalutes to 0, with the `"foo"` part ignored.
267- //
268- // By the time the `#[proc_macro_derive]` function
269- // implementing `#[derive($proc_macro_name)]` is called,
270- // `$paren` has already been replaced with the input of this inner macro,
271- // but `stringify!` has not been expanded yet.
272- //
273- // This how arbitrary tokens can be inserted
274- // in the input to the `#[proc_macro_derive]` function.
275- //
276- // Later, `stringify!(...)` is expanded into a string literal
277- // which is then ignored.
278- // Using `stringify!` enables passing arbitrary tokens
279- // rather than only what can be parsed as a const expression.
280- Input = ( 0 , stringify! $paren ) . 0 ,
281- }
282- }
283- }
257+ ( $proc_macro_name: ident ! $paren: tt) => {
258+ #[ derive( $proc_macro_name) ]
259+ #[ allow( unused) ]
260+ enum ProceduralMasqueradeDummyType {
261+ // The magic happens here.
262+ //
263+ // We use an `enum` with an explicit discriminant
264+ // because that is the only case where a type definition
265+ // can contain a (const) expression.
266+ //
267+ // `(0, "foo").0` evalutes to 0, with the `"foo"` part ignored.
268+ //
269+ // By the time the `#[proc_macro_derive]` function
270+ // implementing `#[derive($proc_macro_name)]` is called,
271+ // `$paren` has already been replaced with the input of this inner macro,
272+ // but `stringify!` has not been expanded yet.
273+ //
274+ // This how arbitrary tokens can be inserted
275+ // in the input to the `#[proc_macro_derive]` function.
276+ //
277+ // Later, `stringify!(...)` is expanded into a string literal
278+ // which is then ignored.
279+ // Using `stringify!` enables passing arbitrary tokens
280+ // rather than only what can be parsed as a const expression.
281+ Input = ( 0 , stringify! $paren ) . 0 ,
282+ }
283+ }
284+ }
284285 } ;
285286}
0 commit comments