Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a comment why extern crate is necessary for rustdoc #76728

Merged
merged 2 commits into from
Sep 16, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@

#[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.
// Dependencies listed in Cargo.toml do not need extern crate.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the question now is why does rustdoc have to search dependencies in sysroot rather than specify them in Cargo.toml.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's because we don't build it in the rustc cargo directory, in part because that gives us finer-grained deleting. That means if we specified things in Cargo.toml, we'd end up rebuilding rustc crates.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the comment to mention why rustdoc uses the sysroot instead of cargo.toml.

extern crate rustc_ast;
extern crate rustc_ast_pretty;
extern crate rustc_attr;
Expand All @@ -42,8 +48,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;
Expand Down