Skip to content

Commit 72c08a4

Browse files
committed
rustdoc: Don't inject extern crate std.
No need to duplicate the compiler's work! Closes #14999
1 parent 19260b0 commit 72c08a4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/librustdoc/test.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ pub fn maketest(s: &str, cratename: Option<&str>, lints: bool) -> String {
209209
");
210210
}
211211

212-
if !s.contains("extern crate") {
212+
// Don't inject `extern crate std` because it's already injected by the
213+
// compiler.
214+
if !s.contains("extern crate") && cratename != Some("std") {
213215
match cratename {
214216
Some(cratename) => {
215217
if s.contains(cratename) {

0 commit comments

Comments
 (0)