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

Nightly rustdoc warns about code block if it contains comments and tab #48068

Closed
pravic opened this issue Feb 8, 2018 · 10 comments
Closed

Nightly rustdoc warns about code block if it contains comments and tab #48068

pravic opened this issue Feb 8, 2018 · 10 comments
Assignees
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@pravic
Copy link
Contributor

pravic commented Feb 8, 2018

A code block inside documentation with rust,no_run directive:

let mut p = String::from("/path");
p.clear();	/* some comment indented with tab */

Nightly compiler throws a warning about it:

Doc-tests hello
WARNING: src\lib.rs - (line 5) Code block is not currently run as a test, but will in future versions of rustdoc. Please ensure this code block is a runnable test, or use the ignore directive.
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

And ignore doesn't help as well though.

Full sample: https://gist.github.com/anonymous/56d5eb5927c50b2a3a22f67723363f45#file-playground-rs-L5-L8

Rust version:

rustc 1.25.0-nightly (bd98fe0 2018-02-06)
binary: rustc
commit-hash: bd98fe0
commit-date: 2018-02-06
host: i686-pc-windows-msvc
release: 1.25.0-nightly
LLVM version: 4.0

@kennytm
Copy link
Member

kennytm commented Feb 8, 2018

It is warned starting on nightly only because of #47398. If you --enable-commonmark the warnings will be emitted on 1.23.0 (stable) as well. No repro on 1.22.1 though.

cc @GuillaumeGomez

@GuillaumeGomez
Copy link
Member

Looking what's wrong.

@GuillaumeGomez GuillaumeGomez self-assigned this Feb 8, 2018
@GuillaumeGomez
Copy link
Member

The warning comes if you have the following code:

/*! Sample documentation.
Just a library with some code:
```rust,no_run
let mut p = String::from("/path");
p.clear();	/* some comment */
```
*/

But not if you have:

/*! Sample documentation.

Just a library with some code:

```rust,no_run
let mut p = String::from("/path");
p.clear();	/* some comment */
```
*/

The whole issue being that hoedown doesn't recognize the first one as being a code block. I'll close this issue for now. This won't be thrown out when the new release will get out anyway since all hoedown will be removed from the compiler.

@pravic
Copy link
Contributor Author

pravic commented Feb 10, 2018

@GuillaumeGomez But the gist contained space between comment and code block?

@steveklabnik steveklabnik reopened this Feb 11, 2018
@steveklabnik
Copy link
Member

yes, re-opening since the gist does look like what is supposed to work.

@ollie27
Copy link
Member

ollie27 commented Feb 11, 2018

The issue here is that hoedown converts tabs to spaces in code blocks but pulldown-cmark doesn't so rustdoc thinks it has found a new test.

@GuillaumeGomez
Copy link
Member

Since we don't have hoedown around anymore, can we close this issue?

@pravic
Copy link
Contributor Author

pravic commented Mar 27, 2018

At the moment there is no warning neither in stable nor nightly :)

@ollie27
Copy link
Member

ollie27 commented Mar 27, 2018

The issue will only affect 1.25, so it's probably too late to fix this now.

@GuillaumeGomez
Copy link
Member

Then I close it for good!

epage added a commit to epage/liquid-rust that referenced this issue Apr 10, 2018
Markdown parsers and more are foited onto clients because of Skeptic.
This is inspired by the conversation at budziq/rust-skeptic#60 regarding
a "skeptic-lite" using rustdoc.

Apparently, the stable version of rustdoc needs newlines between the
preceding paragraph and the code-block.  See rust-lang/rust#48068.
@QuietMisdreavus QuietMisdreavus added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label May 15, 2018
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

6 participants