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
where ///____assert!(true); produce CodeBlock for the first function (generated docs), but #[doc = "____assert!(true);"] produce plain text paragraph for the second function (generated docs).
This behavior might be usefull for saving identical indents in documentation declared in comments and attributes:
/// Some docs#[cfg_attr(feature = "foo", doc = #" continuation with visually the same indentation"#)]/// continuation with visually the same indentation
but in general this behavior is not explicit.
For example syn crate produce exactly the same output when parsing docs both functions with syn::parse_file and preserves all the spaces.
If this behavior is intentional it should be docummented.
According to https://doc.rust-lang.org/rustdoc/the-doc-attribute.html
the lines below are the same:
But when mixing doc-comments and doc-attributes indentation in the next comment or attribute is ignored.
For example
cargo doc
generate different doc pages forand
where
///____assert!(true);
produceCodeBlock
for the first function (generated docs), but#[doc = "____assert!(true);"]
produce plain text paragraph for the second function (generated docs).This behavior might be usefull for saving identical indents in documentation declared in comments and attributes:
but in general this behavior is not explicit.
For example syn crate produce exactly the same output when parsing docs both functions with
syn::parse_file
and preserves all the spaces.If this behavior is intentional it should be docummented.
More examples:
Reproduced with
cargo doc
onrustc 1.47.0 (18bf6b4f0 2020-10-07)
andrustc 1.49.0-nightly (91a79fb29 2020-10-07)
The text was updated successfully, but these errors were encountered: