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

Cannot write doc-tests in markdown files #76709

Closed
jyn514 opened this issue Sep 14, 2020 · 5 comments
Closed

Cannot write doc-tests in markdown files #76709

jyn514 opened this issue Sep 14, 2020 · 5 comments
Labels
A-doctests Area: Documentation tests, run by rustdoc A-markdown-parsing Area: Markdown parsing for doc-comments C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Sep 14, 2020

Currently, it gives this error:

error[E0585]: found a documentation comment that doesn't document anything
 --> /checkout/src/doc/rustdoc/src/what-to-include.md:68:1
  |
7 | /// ```
  | ^^^^^^^
  |
  = help: doc comments must come before what they document, maybe a comment was intended with `//`?

Rustdoc should always run doctests in markdown, since there's no code to document.

Originally posted by @jyn514 in #75778 (comment)

@jyn514 jyn514 added A-doctests Area: Documentation tests, run by rustdoc T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Sep 14, 2020
@GuillaumeGomez
Copy link
Member

I tested with:

# hello

This is test time!

```rust
let x = 12;
```

And ran it without issues:

$ rustdoc --test foo.md 

running 1 test
test foo.md - hello (line 5) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

@steveklabnik
Copy link
Member

steveklabnik commented Oct 14, 2020

That's something different though; this is about doc tests inside of code blocks in markdown files.

@jyn514 it's not clear from your post; the error here is about not having an item to document. If you create one, does it properly do this, or not?

@GuillaumeGomez
Copy link
Member

Just like @steveklabnik pointed out, a bit more context would be welcome. :)

@jyn514
Copy link
Member Author

jyn514 commented Oct 14, 2020

Hmm, I can no longer reproduce this. @AndyGauge do you happen to have a copy of the code that caused this failure? The error message in e9e5b2a#r475234292 doesn't match up with the code you have.

@GuillaumeGomez
Copy link
Member

We didn't hear from @AndyGauge since then so I'll close this until we have more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-doctests Area: Documentation tests, run by rustdoc A-markdown-parsing Area: Markdown parsing for doc-comments C-bug Category: This is a bug. 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

4 participants