Skip to content

Commit

Permalink
Remove internal liblog
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
alexcrichton committed Mar 16, 2017
1 parent 0aeb9c1 commit a4bd5e9
Show file tree
Hide file tree
Showing 31 changed files with 70 additions and 971 deletions.
53 changes: 21 additions & 32 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ fn main() {
cmd.arg("-Cprefer-dynamic");
}

if env::var_os("RUSTC_PASS_RUSTBUILD_FLAG").is_some() {
cmd.arg("--cfg").arg("rustbuild");
}

// Help the libc crate compile by assisting it in finding the MUSL
// native libraries.
if let Some(s) = env::var_os("MUSL_ROOT") {
Expand Down
13 changes: 13 additions & 0 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,19 @@ impl Build {
.env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_libdir(compiler));
}

// Most of the time we want to pass `--cfg rustbuild` which will flag
// upstream crates.io crates to compile themselves as unstable as we're
// going to put them in the sysroot. If we're compiling tools, however,
// we don't want to do that as the upstream crates.io deps may be in the
// crate graph and we don't want to compile them with their unstable
// versions.
match mode {
Mode::Tool => {}
_ => {
cargo.env("RUSTC_PASS_RUSTBUILD_FLAG", "1");
}
}

// Ignore incremental modes except for stage0, since we're
// not guaranteeing correctness acros builds if the compiler
// is changing under your feet.`
Expand Down
9 changes: 0 additions & 9 deletions src/liblog/Cargo.toml

This file was deleted.

Loading

0 comments on commit a4bd5e9

Please sign in to comment.