-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.
Description
Problem
Using pub extern crate to re-export a crate will cause the rest of the file to be formatted as a code block. See the below screenshots.
No re-export
Re-export
Steps
- Create a library that depends on any crate, for example:
Cargo.toml
[package]
name = "tmp"
version = "0.1.0"
edition = "2024"
[dependencies]
core2 = "0.4.0"- Re-export the crate using
pub extern crate
lib.rs
pub extern crate core2;
/// Doc
pub struct S;- Run
cargo doc, and observe the bug
Possible Solution(s)
No response
Notes
I suspect the code block in the generated docs that contains pub extern crate core2; doesn't get closed, causing the rest of the file to also become a code block.
This behavior is currently observable in stable, and was introduced to nightly at some point between 2025-09-14 and 2025-11-27.
Version
cargo 1.92.0 (344c4567c 2025-10-21)
release: 1.92.0
commit-hash: 344c4567c634a25837e3c3476aac08af84cf9203
commit-date: 2025-10-21
host: x86_64-unknown-linux-gnu
libgit2: 1.9.1 (sys:0.20.2 vendored)
libcurl: 8.15.0-DEV (sys:0.4.83+curl-8.15.0 vendored ssl:OpenSSL/3.5.4)
ssl: OpenSSL 3.5.4 30 Sep 2025
os: Debian 13.0.0 (trixie) [64-bit]
lambda
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.