Skip to content

Doc-examples using #[doc] do not have triple backticks stripped before being compiled #78964

Closed
@AldaronLau

Description

@AldaronLau

Nightly code fails to compile.

Code

I tried this code:

#![cfg_attr(
    feature = "std",
    doc = r#"
        ```rust,no_run
        // Lots of rust code
        ```
    "#
)]

I expected to see this happen: Compiling and working like it does on stable.

Instead, compiler says:

error: unknown start of token: `
   |
24 |     ```
   |     ^
   |
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
   |
24 |     '``
   |     ^

Version it worked on

It most recently worked on: rustc 1.49.0-nightly (ffa2e7a 2020-10-24)

Version with regression

rustc --version --verbose:

rustc 1.49.0-nightly (cf9cf7c92 2020-11-10)
binary: rustc
commit-hash: cf9cf7c923eb01146971429044f216a3ca905e06
commit-date: 2020-11-10
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-markdown-parsingArea: Markdown parsing for doc-commentsP-highHigh priorityT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions