-
Notifications
You must be signed in to change notification settings - Fork 0
[Derive] #[doc = macro_name!()]
doesn't play well with doc comments
#194
Comments
Comment by rami3l I investigated the current codebase for quite a while, and the main problem we have here seems to be the following: When will the macro be expanded? Ideally |
Comment by epage I went down a different rabbit hole, in hopes that bumping MSRV and maybe proc macro deps might be of assistance. I'm guessing not but at least we have clap-rs/clap#2640 I'll look into that part. Part of the problem is we do post-processing on the doc comment to better format it. iirc we have a verbatim flag which could work with it. I'll dig a little into these parts. |
Comment by epage From rust-lang/rust#83366
Still fairly weak on my proc macros but I think this is confirming that we have to pass along the macro call for later expansion, which means it is unlikely to work with |
Comment by epage I guess one option is we can either generate or embed some const-fns that do the post-processing for us. |
Comment by rami3l @epage Yeah, I saw that post-processing part. Before, with only doc literals, it's reasonable to do this in the derive macro. However, when the doc macros come into play, it seems impossible (at least to both of us) to keep it this way: the call site has to be changed. But don't worry, once the macro call has been transferred to the call side, we should be able to use something like the It's true that Of course, we have to be very careful about |
Comment by rami3l @epage Wait a second, does rust-lang/rust#87264 include the eager expansion that we want? If so, we can wait for it! (And in that case I know exactly which function should be modified!) |
Issue by rami3l
Thursday Jul 29, 2021 at 19:22 GMT
Originally opened as clap-rs/clap#2639
Please complete the following tasks
Rust Version
1.54.0
Clap Version
master
Minimal reproducible code
Steps to reproduce the bug with the above code
Run the test above.
Actual Behaviour
Assertions fail with no comments help message detected:
Expected Behaviour
Assertions pass with all help messages specified by the macro call.
Additional Context
No response
Debug Output
No response
The text was updated successfully, but these errors were encountered: