Skip to content

Commit 6e57eec

Browse files
authored
Rollup merge of #76728 - jyn514:rustdoc-extern-crate, r=ehuss
Add a comment why `extern crate` is necessary for rustdoc r? @ehuss From #74293 (comment).
2 parents 153fb91 + b93a831 commit 6e57eec

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/librustdoc/lib.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@
1616

1717
#[macro_use]
1818
extern crate lazy_static;
19+
#[macro_use]
20+
extern crate tracing;
21+
22+
// N.B. these need `extern crate` even in 2018 edition
23+
// because they're loaded implicitly from the sysroot.
24+
// The reason they're loaded from the sysroot is because
25+
// the rustdoc artifacts aren't stored in rustc's cargo target directory.
26+
// So if `rustc` was specified in Cargo.toml, this would spuriously rebuild crates.
27+
//
28+
// Dependencies listed in Cargo.toml do not need `extern crate`.
1929
extern crate rustc_ast;
2030
extern crate rustc_ast_pretty;
2131
extern crate rustc_attr;
@@ -42,8 +52,6 @@ extern crate rustc_target;
4252
extern crate rustc_trait_selection;
4353
extern crate rustc_typeck;
4454
extern crate test as testing;
45-
#[macro_use]
46-
extern crate tracing;
4755

4856
use std::default::Default;
4957
use std::env;

0 commit comments

Comments
 (0)