Skip to content

Doctest broken by rustdoc in 1.53 nightly #10

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

Closed
dtolnay opened this issue Apr 24, 2021 · 0 comments
Closed

Doctest broken by rustdoc in 1.53 nightly #10

dtolnay opened this issue Apr 24, 2021 · 0 comments

Comments

@dtolnay
Copy link
Owner

dtolnay commented Apr 24, 2021

Specifically this test:

seq-macro/src/lib.rs

Lines 44 to 60 in b9d1fd4

//! ```
//! use seq_macro::seq;
//!
//! seq!(N in 64..=127 {
//! #[derive(Debug)]
//! enum Demo {
//! // Expands to Variant64, Variant65, ...
//! #(
//! Variant#N,
//! )*
//! }
//! });
//!
//! fn main() {
//! assert_eq!("Variant99", format!("{:?}", Demo::Variant99));
//! }
//! ```

rust-lang/rust#84445 changed rustdoc's handling of lines that begin with # not followed by whitespace. Previously the doc code compiled and rendered correctly as written, since the line #( was nothing special to rustdoc. After that PR, the doc code renders incorrectly:

seq!(N in 64..=127 {
    #[derive(Debug)]
    enum Demo {
        // Expands to Variant64, Variant65, ...
            Variant#N,
        )*
    }
});

and fails to compile, since rustdoc is trimming the #( into a hidden line containing only (:

---- src/lib.rs - (line 44) stdout ----
error: expected identifier, found `(`
  --> src/lib.rs:51:1
   |
9  | / (
10 | |             Variant#N,
11 | |         )*
   | |_________^ expected identifier

error[E0433]: failed to resolve: use of undeclared type `Demo`
  --> src/lib.rs:58:45
   |
16 |     assert_eq!("Variant99", format!("{:?}", Demo::Variant99));
   |                                             ^^^^ use of undeclared type `Demo`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant