Closed
Description
The following is a perfectly valid Markdown, however, Rustdoc does not compile the piece of code (and, naturally, it is not run as a test with cargo test
):
/// This is a test:
/// ```rust
/// let x = SomeUnknownStructure::new();
/// ```
This, however, does work:
/// This is a test:
///
/// ```rust
/// let x = SomeUnknownStructure::new();
/// ```
(that is, it fails to compile due to unknown symbol SomeUnknownStructure
).
Note the empty line before the code block in the doc comment.
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
Aatch commentedon Sep 30, 2015
Does it render correctly? If not it may be a bug in the mardown parser.
netvl commentedon Sep 30, 2015
It looks like that it also renders incorrectly:

This is for the first snippet from the original post, the second snippet looks correctly.
sfackler commentedon Sep 30, 2015
This is how at least some markdown parsers work - without a double line break before the tick marks, it's treated as part of the previous paragraph.
Aatch commentedon Oct 2, 2015
The decision now then is whether we consider this working-as-expected or an actual bug?
steveklabnik commentedon Oct 2, 2015
CommonMark says
http://spec.commonmark.org/0.22/#code-fence
So I would argue it is a bug.
cjsut commentedon Mar 8, 2016
Also affects lists.
http://spec.commonmark.org/0.24/#lists
ignore
gets compiled and executed #32556test: Mark the gluon example code as f# so its not treated as a doc test
Mark-Simulacrum commentedon Jul 24, 2017
With
-Zunstable-options --enable-commonmark
, rustdoc emits the following today, so I'm going to close this.Enable doctests
self
#50799