Skip to content

Doc test bug: recognize /// - a as doctest #104810

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
gwy15 opened this issue Nov 24, 2022 · 2 comments
Closed

Doc test bug: recognize /// - a as doctest #104810

gwy15 opened this issue Nov 24, 2022 · 2 comments
Labels
C-bug Category: This is a bug.

Comments

@gwy15
Copy link

gwy15 commented Nov 24, 2022

I tried this code:

/// comment
///
/// -               panic!()
pub fn f() {}

I expected to see this happen when running cargo test: nothing

Instead, this happened: thread 'main' panicked at 'explicit panic', src/lib.rs:3:1

Meta

rustc --version --verbose:

rustc 1.65.0 (897e37553 2022-11-02)
binary: rustc
commit-hash: 897e37553bba8b42751c67658967889d11ecd120
commit-date: 2022-11-02
host: aarch64-apple-darwin
release: 1.65.0
LLVM version: 15.0.0
@gwy15 gwy15 added the C-bug Category: This is a bug. label Nov 24, 2022
@albertlarsan68
Copy link
Member

It does also reproduce with

rustc 1.66.0-beta.2 (0040709e3 2022-11-20)
binary: rustc
commit-hash: 0040709e39bfa159d099ee14628ad4ac72f91406
commit-date: 2022-11-20
host: x86_64-pc-windows-msvc
release: 1.66.0-beta.2
LLVM version: 15.0.2

and

rustc 1.67.0-nightly (70f8737b2 2022-11-23)
binary: rustc
commit-hash: 70f8737b2f5d3bf7d6b784fad00b663b7ff9feda
commit-date: 2022-11-23
host: x86_64-pc-windows-msvc
release: 1.67.0-nightly
LLVM version: 15.0.4

@ehuss
Copy link
Contributor

ehuss commented Nov 24, 2022

Thanks for the report! I understand this is a bit confusing, but it is mostly working as intended. The commonmark spec specifies that indented text is a code block. Rustdoc by default treats all code blocks as "rust" code unless otherwise specified.

I'm going to close since this has been reported before. Closing as a duplicate of #64162, #59867, #88590, #100225.

@ehuss ehuss closed this as not planned Won't fix, can't repro, duplicate, stale Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants