You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is unstable feature and it is used in rustc master already.
Reacted by Luke, Roland Fredenhagen, Jonas Schievink, Rodrigo, Alexander Novotny, Peter Lyons Kehl, Fathy Boundjadj, Diana, TehPers, Ľubomír Kurčák and 9 more
A workaround: Have a proc_macro that generates the string, injects it in #[doc = "..." ] (escaping any backslashes \ into \\ and any quotes " into \\\") and generates your desired item (along with that #[doc = "..." ]).
Tedious, and it requires an extra proc_macro crate (unless you're generating proc macros already). But, chances are that you're already generating your desired code either with macro_rules! or proc macros, so it's not much more science. (The proc macro itself would be simple and is feasible without syn and quote, potentially generating proc_macro::TokenStream with my_generated_code_string.parse().unwrap(), or with proc_macro API, hence lightweight.)
Since this is still an issue and I havent seen it mentioned anywhere, this depended on the now stable extended_key_value_attributes, which had a tracking issue on this side which was closed in favor of this issue.
extended_key_value_attributes was stabilized a few months after these issues were opened back in 2021, but when it got stabilized little further seems to have been done beyond newer issues being closed as duplicates of this.
This has been a stable feature for years, std and many other crates rely on it for their documentation, and more continue to as time goes on, and rust-analyzer doesn't render docs using it correctly
Activity
jonas-schievink commentedon Mar 18, 2021
cc #7779
jonas-schievink commentedon Mar 21, 2021
I guess this is related to #7049
mvforell commentedon Mar 17, 2022
This would be very useful for generating
docattributs in macros, e.g. like described at https://stackoverflow.com/a/43353854:Currently, the above doc gets rendered as
instead of
sanbox-irl commentedon May 3, 2023
To add to this discussion -- since the std uses this macro, many examples in the std do not read correctly right now:
peter-lyons-kehl commentedon May 25, 2023
A workaround: Have a
proc_macrothat generates the string, injects it in#[doc = "..." ](escaping any backslashes\into\\and any quotes"into\\\") and generates your desired item (along with that#[doc = "..." ]).Tedious, and it requires an extra
proc_macrocrate (unless you're generating proc macros already). But, chances are that you're already generating your desired code either withmacro_rules!or proc macros, so it's not much more science. (The proc macro itself would be simple and is feasible withoutsynandquote, potentially generatingproc_macro::TokenStreamwithmy_generated_code_string.parse().unwrap(), or withproc_macroAPI, hence lightweight.)Workaround rust-lang/rust-analyzer/issues/8092 and rust-lang/rust-ana…
DianaNites commentedon Jul 10, 2024
Since this is still an issue and I havent seen it mentioned anywhere, this depended on the now stable
extended_key_value_attributes, which had a tracking issue on this side which was closed in favor of this issue.extended_key_value_attributeswas stabilized a few months after these issues were opened back in 2021, but when it got stabilized little further seems to have been done beyond newer issues being closed as duplicates of this.This has been a stable feature for years, std and many other crates rely on it for their documentation, and more continue to as time goes on, and rust-analyzer doesn't render docs using it correctly
Document why rust-analyzer doesn't show action name in action docs (#…
so1ve commentedon Apr 1, 2026
@rustbot claim
Document why rust-analyzer doesn't show action name in action docs (#…