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
When using the following as module level or item level doc test (module level shown in example) ...
//! ```test_harness,norun
//! # // This is hidden, but the following empty hidden line causes trouble
//! #
//! # #[test] fn egal() {
//! // visible
//! # }
... the generated markdown looks like this ...
... and the output of cargo test like that:
[...]
---- _0 stdout ----
<anon>:5:1: 5:2 error: expected one of `!` or `[`, found `#`<anon>:5 #[test] fn egal() { ^thread '_0' panicked at 'Box<Any>', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libsyntax/diagnostic.rs:92[...]
If the empty hidden line # is removed, it will work such as in the following:
//! ```test_harness,norun
//! # // The hidden empty line was removed, which fixes the issue.
//! # #[test] fn egal() {
//! // visible
//! # }
This is a minor issue, but one that can cause some headaches as people might just not understand what's wrong that easily, at least when looking at the error messages.
Desired behaviour would be to just ignore empty hidden lines entirely.
Yes right now rustdoc will only strip lines that start with "# " (note the space after the #) and it looks like you may not have a space after the #-character. Regardless though @steveklabnik is right, could you open this on the rust-lang/rust repo instead of this if you'd like to continue pursuing it? Thanks!
When using the following as module level or item level doc test (module level shown in example) ...
... the generated markdown looks like this ...

... and the output of
cargo test
like that:If the empty hidden line
#
is removed, it will work such as in the following:This is a minor issue, but one that can cause some headaches as people might just not understand what's wrong that easily, at least when looking at the error messages.
Desired behaviour would be to just ignore empty hidden lines entirely.
Meta
The text was updated successfully, but these errors were encountered: