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

[Hoedown comeback regression] Code in doc not tested with future warning, when it was always a test in the past #41401

Closed
kennytm opened this issue Apr 19, 2017 · 7 comments
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@kennytm
Copy link
Member

kennytm commented Apr 19, 2017

Test case:

// src/lib.rs

/// ```
/// assert!(true);
/// ```
///
/// ```
/// assert!(true);
/// ```
pub fn test() {}

Expected: when running cargo test, it will run two doctests (as in stable and beta).

running 2 tests
test src/lib.rs - test (line 1) ... ok
test src/lib.rs - test (line 5) ... ok

Actual: Only the first doctest is run, the second one is skipped, with this warning:

WARNING: src/lib.rs - test (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 1 test
test src/lib.rs - test (line 1) ... ok

Real life test case:

(cc @GuillaumeGomez #41290)


No warnings in this version:

rustdoc 1.18.0-nightly (28a742997 2017-04-13)
binary: rustdoc
commit-hash: 28a74299778cdad4ea999e4ee8f8c1ef793338bd
commit-date: 2017-04-13
host: x86_64-apple-darwin
release: 1.18.0-nightly
LLVM version: 3.9

Have warnings in this version:

rustdoc 1.18.0-nightly (9f2abadca 2017-04-18)
binary: rustdoc
commit-hash: 9f2abadca2d065bf81772cb84981d0a22d8e98b3
commit-date: 2017-04-18
host: x86_64-apple-darwin
release: 1.18.0-nightly
LLVM version: 3.9
@steveklabnik steveklabnik added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools labels Apr 19, 2017
@steveklabnik
Copy link
Member

@kennytm
Copy link
Member Author

kennytm commented Apr 19, 2017

@steveklabnik It is rendered as two separate blocks in Hoedown (in stable). It is just that rustdoc now becomes too conservative in classifying code blocks as tests.

@steveklabnik
Copy link
Member

@kennytm yes, sorry. It looks like this is a hoedown bug; @GuillaumeGomez is on the case

@GuillaumeGomez
Copy link
Member

Problem comes from the fact that hoedown gives an invalid line number so I have to fix code we want to remove. T_T

@dtolnay
Copy link
Member

dtolnay commented Apr 19, 2017

Anyone know a workaround for this? Are there any magic changes I can make to my doc comment for now to get both blocks to run?

@kennytm
Copy link
Member Author

kennytm commented Apr 19, 2017

@dtolnay You could add an explicit paragraph break between the code blocks e.g.

/// ```
/// assert!(true);
/// ```
///
/// <!-- -->
///
/// ```
/// assert!(true);
/// ```

But I'd just wait for the next nightly which has this bug fixed.

@kennytm
Copy link
Member Author

kennytm commented Apr 20, 2017

Additional test cases:

  1.  /// a
     ///
     /// ```
     /// assert!(true);
     /// ```
     ///
     /// b
     ///
     /// ```
     /// assert!(true);
     /// ```
     pub fn test() {}
  2.  /// | Table |
     /// |-------|
     /// | Value |
     ///
     /// ```rust
     /// assert!(true);
     /// ```
     pub fn test() {}

See #41405 (comment) for details.

@alexcrichton alexcrichton added the regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. label Apr 20, 2017
colin-kiegel added a commit to TedDriggs/rust-derive-builder that referenced this issue Apr 21, 2017
includes a workaround for rust-lang/rust#41401
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 22, 2017
…ovement, r=steveklabnik

Fix line display for hoedown

Fixes rust-lang#41401.

r? @rust-lang/docs
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 22, 2017
…ovement, r=steveklabnik

Fix line display for hoedown

Fixes rust-lang#41401.

r? @rust-lang/docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. 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

5 participants