-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Rustdoc creates doctests with extern crate mod; #79771
Copy link
Copy link
Closed
Labels
A-doctestsArea: Documentation tests, run by rustdocArea: Documentation tests, run by rustdocC-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.
Metadata
Metadata
Assignees
Labels
A-doctestsArea: Documentation tests, run by rustdocArea: Documentation tests, run by rustdocC-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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
In #79770 I tried to create a new
rustdoc-uitestcase that runs doctests. However having themodsubstring in a doctest comment injected an invalidextern crate mod;into the code generated for the doctest.Turns out this here is a bit too aggressive:
rust/src/librustdoc/doctest.rs
Lines 533 to 534 in 0f6f2d6
It looks like compiletest actually gave the crate the name
mod, perhaps because it was defined in aissue-XXX/mod.rsfile, and having a doctest such as this triggers the this auto-injection, resulting in a failed doctest run: