Skip to content

Doc in macro with concat! and stringify! won't show up #14684

Closed
@rodrigocfd

Description

@rodrigocfd

rust-analyzer version: 0.3.1489-standalone (bc78ebd 2023-04-23)

rustc version: 1.69.0 (84c898d65 2023-04-16)

I'm trying to use this method for generating dynamic doc within macros:

macro_rules! my_func {
  ($method:ident, $name:tt) => {
    #[doc = concat!("This is ", stringify!($name), ".")]
    pub fn $method() {}
  };
}

my_func!(foo, "foo");

/// This documentation shows up.
fn another() {}

fn main() {
  foo();
  another();
}

Notice the use of concat! and stringify! to generate the documentation dynamically.

Screenshot 1:

no-show

Screenshot 2:

yes-show

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-idegeneral IDE featuresA-macromacro expansionC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions