Skip to content

Nightly warning for codeblock languages with non-alphanumeric characters #115938

Closed
@cpu

Description

@cpu

Code

I tried this code with cargo doc:

/// This is a test:
/// ```ASN.1
/// foo
/// ```
fn main() {
    println!("Hello, world!");
}

I expected to see this happen: rust doc generated without any warnings.

Instead, this happened:

warning: unexpected character `.`
 --> src/main.rs:1:1
  |
1 | / /// This is a test:
2 | | /// ```ASN.1
3 | | /// foo
4 | | /// ```
  | |_______^
  |
  = note: `#[warn(rustdoc::invalid_codeblock_attributes)]` on by default

"ASN.1" is supported by Linguist. I also see the same result if I specify any codefence languages that include special characters (e.g. C++, C#).

Version it worked on

It most recently worked on: rustc 1.74.0-nightly (8142a319e 2023-09-13)

Version with regression

It fails with a warning on rustc 1.74.0-nightly (203c57dbe 2023-09-17)

rustc --version --verbose:

rustc 1.74.0-nightly (203c57dbe 2023-09-17)
binary: rustc
commit-hash: 203c57dbe20aee67eaa8f7be45d1e4ef0b274109
commit-date: 2023-09-17
host: x86_64-unknown-linux-gnu
release: 1.74.0-nightly
LLVM version: 17.0.0

Possibly related to #110800 ?

@rustbot modify labels: +regression-from-stable-to-nightly -regression-untriaged

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.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