about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTyler Mandry <tmandry@gmail.com>2020-09-16 12:24:10 -0700
committerGitHub <noreply@github.com>2020-09-16 12:24:10 -0700
commit6e57eecb05f9198ef8e6bfa96d62d45b36ac8eff (patch)
tree13218687f7d04860e8584f603eba1fb05800e352 /src
parent153fb91d374b3e054ab779952eb69c62022a9a80 (diff)
parentb93a8315f2fcff479a99e0694309fe12dbe095d5 (diff)
downloadrust-6e57eecb05f9198ef8e6bfa96d62d45b36ac8eff.tar.gz
rust-6e57eecb05f9198ef8e6bfa96d62d45b36ac8eff.zip
Rollup merge of #76728 - jyn514:rustdoc-extern-crate, r=ehuss
Add a comment why `extern crate` is necessary for rustdoc

r? @ehuss

From https://github.com/rust-lang/rust/pull/74293#discussion_r488335500.
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/lib.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index 73a783d5406..7762e8f8d4f 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -16,6 +16,16 @@
 
 #[macro_use]
 extern crate lazy_static;
+#[macro_use]
+extern crate tracing;
+
+// N.B. these need `extern crate` even in 2018 edition
+// because they're loaded implicitly from the sysroot.
+// The reason they're loaded from the sysroot is because
+// the rustdoc artifacts aren't stored in rustc's cargo target directory.
+// So if `rustc` was specified in Cargo.toml, this would spuriously rebuild crates.
+//
+// Dependencies listed in Cargo.toml do not need `extern crate`.
 extern crate rustc_ast;
 extern crate rustc_ast_pretty;
 extern crate rustc_attr;
@@ -42,8 +52,6 @@ extern crate rustc_target;
 extern crate rustc_trait_selection;
 extern crate rustc_typeck;
 extern crate test as testing;
-#[macro_use]
-extern crate tracing;
 
 use std::default::Default;
 use std::env;