In #79770 I tried to create a new rustdoc-ui testcase that runs doctests. However having the mod substring in a doctest comment injected an invalid extern crate mod; into the code generated for the doctest.
Turns out this here is a bit too aggressive:
|
if s.contains(cratename) { |
|
prog.push_str(&format!("extern crate {};\n", cratename)); |
It looks like compiletest actually gave the crate the name mod, perhaps because it was defined in a issue-XXX/mod.rs file, and having a doctest such as this triggers the this auto-injection, resulting in a failed doctest run:
/// ```
/// // ^ mod.rs line 10
/// assert_eq!(1, 1);
/// ```
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: