Skip to content

Commit a6cebc0

Browse files
authored
Rollup merge of rust-lang#40347 - alexcrichton:rm-liblog, r=brson
Remove internal liblog This commit deletes the internal liblog in favor of the implementation that lives on crates.io. Similarly it's also setting a convention for adding crates to the compiler. The main restriction right now is that we want compiler implementation details to be unreachable from normal Rust code (e.g. requires a feature), and by default everything in the sysroot is reachable via `extern crate`. The proposal here is to require that crates pulled in have these lines in their `src/lib.rs`: #![cfg_attr(rustbuild, feature(staged_api, rustc_private))] #![cfg_attr(rustbuild, unstable(feature = "rustc_private", issue = "27812"))] This'll mean that by default they're not using these attributes but when compiled as part of the compiler they do a few things: * Mark themselves as entirely unstable via the `staged_api` feature and the `#![unstable]` attribute. * Allow usage of other unstable crates via `feature(rustc_private)` which is required if the crate relies on any other crates to compile (other than std).
2 parents b449fda + a4bd5e9 commit a6cebc0

File tree

31 files changed

+70
-971
lines changed

31 files changed

+70
-971
lines changed

src/Cargo.lock

+21-32
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bootstrap/bin/rustc.rs

+4
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ fn main() {
9494
cmd.arg("-Cprefer-dynamic");
9595
}
9696

97+
if env::var_os("RUSTC_PASS_RUSTBUILD_FLAG").is_some() {
98+
cmd.arg("--cfg").arg("rustbuild");
99+
}
100+
97101
// Help the libc crate compile by assisting it in finding the MUSL
98102
// native libraries.
99103
if let Some(s) = env::var_os("MUSL_ROOT") {

src/bootstrap/lib.rs

+13
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,19 @@ impl Build {
499499
.env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_libdir(compiler));
500500
}
501501

502+
// Most of the time we want to pass `--cfg rustbuild` which will flag
503+
// upstream crates.io crates to compile themselves as unstable as we're
504+
// going to put them in the sysroot. If we're compiling tools, however,
505+
// we don't want to do that as the upstream crates.io deps may be in the
506+
// crate graph and we don't want to compile them with their unstable
507+
// versions.
508+
match mode {
509+
Mode::Tool => {}
510+
_ => {
511+
cargo.env("RUSTC_PASS_RUSTBUILD_FLAG", "1");
512+
}
513+
}
514+
502515
// Ignore incremental modes except for stage0, since we're
503516
// not guaranteeing correctness acros builds if the compiler
504517
// is changing under your feet.`

src/liblog/Cargo.toml

-9
This file was deleted.

0 commit comments

Comments
 (0)