Skip to content

nightly: unexpected "could not parse code block" in indented block docs in presence of backticks #58473

Closed
@vthriller

Description

@vthriller

I believe this is a minimal example. Warning disappears if either:

  • backticks are removed
  • indentation is removed
  • ///-style formatting is used
// don't even need to be in `impl`, yeah
//pub struct Foo {}
//impl Foo {
    /**
    Does nothing, returns `()`

    yadda-yadda-yadda
    */
    pub fn foo() {}
//}
$ cargo doc
 Documenting rust-nightly-doc-wat v0.1.0 (/home/thriller/tmp/rust-nightly-doc-wat)
    Finished dev [unoptimized + debuginfo] target(s) in 1.08s
$ cargo +nightly doc
 Documenting rust-nightly-doc-wat v0.1.0 (/home/thriller/tmp/rust-nightly-doc-wat)
warning: could not parse code block as Rust code
 --> src/lib.rs:5:5
  |
5 | /     Does nothing, returns `()`
6 | |
7 | |     yadda-yadda-yadda
  | |_____________________^
  |
  = note: error from rustc: unknown start of token: `

    Finished dev [unoptimized + debuginfo] target(s) in 1.29s
$ rustc +nightly --version --verbose
rustc 1.34.0-nightly (e54494727 2019-02-13)
binary: rustc
commit-hash: e54494727855cd14229f5d456591ed2a2f027c46
commit-date: 2019-02-13
host: x86_64-unknown-linux-gnu
release: 1.34.0-nightly
LLVM version: 8.0

(straight from rustup)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions