Using inner attributes on macro's caller

Hi everyone!

I'm currently trying to use the #![doc = ""] inner attribute inside a macro in order to allow me to import some markdown files as API documentation (for the crate-level mostly). However, it seems like the inner attribute is applied to the macro and not to its parent.

So I was wondering: is it possible to make this inner attribute on the macro's caller instead of the macro itself?

Short example of what I'm trying to achieve:

#[macro_export]
macro_rules! doc_comment {
    ($x:expr) => {
        #![doc = $x]
    };
}

doc_comment!("hello!");

Thanks in advance for your help!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.