Closed
Description
possibly related to #13075
the following has a macro that generates documentation for A
and for B
. Rust-Anaylzer displays the documentation just fine for B
, but shows no documentation for A
.
macro_rules! tester {
($x:expr, $n:ident) => {
tester! {@inner concat!("This is ", $x), $n}
};
(@inner $x:expr, $n:ident) => {
#[doc = $x]
const $n: u8 = 1u8;
};
}
tester!("A", A);
tester!(@inner "This is B", B);
fn main() {
A;
B;
}
just to confirm that the docs exist, here's the output of cargo expand
(cargo doc
also confirms a doc string exists for A)
#![feature(prelude_import)]
#[prelude_import]
use std::prelude::rust_2021::*;
#[macro_use]
extern crate std;
///This is A
const A: u8 = 1u8;
///This is B
const B: u8 = 1u8;
fn main() {
A;
B;
}
but using rust-analyzer: Expand Macro Recursively
shows that the 'A' doc has parentheses around it, which would be considered a syntax error
// Recursive expansion of tester! macro
// =====================================
#[doc = ("This is A")]
const A: u8 = 1u8;
// Recursive expansion of tester! macro
// =====================================
#[doc = "This is B"]
const B: u8 = 1u8;
rust-analyzer version: both the release version 0.3.1186-standalone (e8e598f64 2022-08-28)
and pre-release version 0.4.1192-standalone (8ddb8b7e8 2022-09-03)
rustc version: both rustc 1.63.0 (4b91a6ea7 2022-08-08)
and rustc 1.65.0-nightly (84f0c3f79 2022-09-03)
relevant settings: None
Metadata
Metadata
Assignees
Labels
No labels