Expand macro parameters in the comments.

c0fd25e
Opened by Yamakaky at 2020-06-25 15:19:37
macro_rules! test {
  (name:ident) => {
    /// A struct named $name.
    struct $name;
  }
}
  1. @Yamakaky Can you clarify what you mean?

    bluss at 2016-11-22 22:16:09

  2. Sorry: I would like for test!(Name) to expand the comment to /// A struct named Name.

    Yamakaky at 2016-11-22 22:47:16

  3. I see, thank you, that would be a general Rust feature and not just rustdoc, then.

    bluss at 2016-11-22 22:54:34

  4. This might break backward compatibility (if docs are also to be covered by that guarantee) since people might have used $s in their docs already not intending them to be replaced. Also if there is no variable found should it just leave the $word unchanged there or should a warning or error be emitted?

    This feature probably requires a RFC. Relevant discussion: https://github.com/rust-lang/rfcs/issues/1516

    Leonardo Schwarz at 2017-04-29 22:37:18

  5. Any new word on this topic? I feel it could be a useful change for a number of cases e.g. a macros which creates functions in my case.

    Dynisious at 2017-12-20 07:20:48

  6. Any news on this? In some cases structs or functions created by a macro only have a generic doc comment when could give more details.

    Jesus Hernandez at 2020-06-25 15:19:37