Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty # in doc-test causes failure #23106

Closed
Byron opened this issue Mar 6, 2015 · 1 comment
Closed

empty # in doc-test causes failure #23106

Byron opened this issue Mar 6, 2015 · 1 comment
Assignees
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@Byron
Copy link
Member

Byron commented Mar 6, 2015

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. 
//! # // There is indeed a space after '#'
//! # 
//! # #[test] fn egal() {
//! // visible
//! # }

... the generated markdown looks like this ...
screen shot 2015-03-05 at 13 03 10
... 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.

Meta

✗ cargo --version
cargo 0.0.1-pre-nightly (5773064 2015-02-25) (built 2015-02-25)
✗ rustc --version --verbose
rustc 1.0.0-nightly (4db0b3246 2015-02-25) (built 2015-02-25)
binary: rustc
commit-hash: 4db0b32467535d718d6474de7ae8d1007d900818
commit-date: 2015-02-25
build-date: 2015-02-25
host: x86_64-apple-darwin
release: 1.0.0-nightly
@steveklabnik steveklabnik added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Mar 8, 2015
@alexcrichton alexcrichton self-assigned this Apr 7, 2015
@Byron
Copy link
Member Author

Byron commented Apr 10, 2015

Thank you :) !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants