Skip to content

Commit 37a991a

Browse files
committed
Auto merge of #42664 - alexcrichton:moar-crates, r=eddyb
Remove in-tree flate/getopts crates Remove `src/libflate` in favor of `flate2` on crates.io and `src/libgetopts` in favor of `getopts` on crates.io. The replacements have slightly different APIs and the usage in the compiler has been updated to reflect this. This uncovered an unfortunate limitation of the compiler today to deal with linking everything correctly, and the workaround can be found documented in `src/librustc/Cargo.toml`.
2 parents 6ccfe68 + 5c3d0e6 commit 37a991a

File tree

33 files changed

+388
-2408
lines changed

33 files changed

+388
-2408
lines changed

COPYRIGHT

-6
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ The Rust Project includes packages written by third parties.
2222
The following third party packages are included, and carry
2323
their own copyright notices and license terms:
2424

25-
* The src/rt/miniz.c file, carrying an implementation of
26-
RFC1950/RFC1951 DEFLATE, by Rich Geldreich
27-
<[email protected]>. All uses of this file are
28-
permitted by the embedded "unlicense" notice
29-
(effectively: public domain with warranty disclaimer).
30-
3125
* LLVM. Code for this package is found in src/llvm.
3226

3327
Copyright (c) 2003-2013 University of Illinois at

src/Cargo.lock

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

src/bootstrap/dist.rs

-1
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,6 @@ pub fn rust_src(build: &Build) {
567567
"src/rustc/libc_shim",
568568
"src/libtest",
569569
"src/libterm",
570-
"src/libgetopts",
571570
"src/compiler-rt",
572571
"src/jemalloc",
573572
"src/libprofiler_builtins",

src/libflate/Cargo.toml

-14
This file was deleted.

src/libflate/build.rs

-18
This file was deleted.

src/libflate/lib.rs

-166
This file was deleted.

src/libgetopts/Cargo.toml

-9
This file was deleted.

src/librustc/Cargo.toml

+29
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,32 @@ rustc_errors = { path = "../librustc_errors" }
2222
serialize = { path = "../libserialize" }
2323
syntax = { path = "../libsyntax" }
2424
syntax_pos = { path = "../libsyntax_pos" }
25+
26+
# Note that these dependencies are a lie, they're just here to get linkage to
27+
# work.
28+
#
29+
# We're creating a bunch of dylibs for the compiler but we're also compiling a
30+
# bunch of crates.io crates. Everything in the compiler is compiled as an
31+
# rlib/dylib pair but all crates.io crates tend to just be rlibs. This means
32+
# we've got a problem for dependency graphs that look like:
33+
#
34+
# foo - rustc_trans
35+
# / \
36+
# rustc ---- rustc_driver
37+
# \ /
38+
# foo - rustc_metadata
39+
#
40+
# Here the crate `foo` is linked into the `rustc_trans` and the
41+
# `rustc_metadata` dylibs, meaning we've got duplicate copies! When we then
42+
# go to link `rustc_driver` the compiler notices this and gives us a compiler
43+
# error.
44+
#
45+
# To work around this problem we just add these crates.io dependencies to the
46+
# `rustc` crate which is a shared dependency above. That way the crate `foo`
47+
# shows up in the dylib for the `rustc` crate, deduplicating it and allowing
48+
# crates like `rustc_trans` to use `foo` *through* the `rustc` crate.
49+
#
50+
# tl;dr; this is not needed to get `rustc` to compile, but if you remove it then
51+
# later crate stop compiling. If you can remove this and everything
52+
# compiles, then please feel free to do so!
53+
flate2 = "0.2"

src/librustc/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#![feature(discriminant_value)]
4242
#![feature(sort_unstable)]
4343
#![feature(trace_macros)]
44+
#![feature(test)]
4445

4546
#![recursion_limit="256"]
4647

@@ -63,6 +64,11 @@ extern crate syntax_pos;
6364

6465
extern crate serialize as rustc_serialize; // used by deriving
6566

67+
// Note that librustc doesn't actually depend on these crates, see the note in
68+
// `Cargo.toml` for this crate about why these are here.
69+
extern crate flate2;
70+
extern crate test;
71+
6672
#[macro_use]
6773
mod macros;
6874

0 commit comments

Comments
 (0)