Skip to content

Commit

Permalink
Auto merge of #42664 - alexcrichton:moar-crates, r=eddyb
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
bors committed Jun 21, 2017
2 parents 6ccfe68 + 5c3d0e6 commit 37a991a
Show file tree
Hide file tree
Showing 33 changed files with 388 additions and 2,408 deletions.
6 changes: 0 additions & 6 deletions COPYRIGHT
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ The Rust Project includes packages written by third parties.
The following third party packages are included, and carry
their own copyright notices and license terms:

* The src/rt/miniz.c file, carrying an implementation of
RFC1950/RFC1951 DEFLATE, by Rich Geldreich
<richgel99@gmail.com>. All uses of this file are
permitted by the embedded "unlicense" notice
(effectively: public domain with warranty disclaimer).

* LLVM. Code for this package is found in src/llvm.

Copyright (c) 2003-2013 University of Illinois at
Expand Down
20 changes: 5 additions & 15 deletions src/Cargo.lock

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

1 change: 0 additions & 1 deletion src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,6 @@ pub fn rust_src(build: &Build) {
"src/rustc/libc_shim",
"src/libtest",
"src/libterm",
"src/libgetopts",
"src/compiler-rt",
"src/jemalloc",
"src/libprofiler_builtins",
Expand Down
14 changes: 0 additions & 14 deletions src/libflate/Cargo.toml

This file was deleted.

18 changes: 0 additions & 18 deletions src/libflate/build.rs

This file was deleted.

166 changes: 0 additions & 166 deletions src/libflate/lib.rs

This file was deleted.

9 changes: 0 additions & 9 deletions src/libgetopts/Cargo.toml

This file was deleted.

29 changes: 29 additions & 0 deletions src/librustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,32 @@ rustc_errors = { path = "../librustc_errors" }
serialize = { path = "../libserialize" }
syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" }

# Note that these dependencies are a lie, they're just here to get linkage to
# work.
#
# We're creating a bunch of dylibs for the compiler but we're also compiling a
# bunch of crates.io crates. Everything in the compiler is compiled as an
# rlib/dylib pair but all crates.io crates tend to just be rlibs. This means
# we've got a problem for dependency graphs that look like:
#
# foo - rustc_trans
# / \
# rustc ---- rustc_driver
# \ /
# foo - rustc_metadata
#
# Here the crate `foo` is linked into the `rustc_trans` and the
# `rustc_metadata` dylibs, meaning we've got duplicate copies! When we then
# go to link `rustc_driver` the compiler notices this and gives us a compiler
# error.
#
# To work around this problem we just add these crates.io dependencies to the
# `rustc` crate which is a shared dependency above. That way the crate `foo`
# shows up in the dylib for the `rustc` crate, deduplicating it and allowing
# crates like `rustc_trans` to use `foo` *through* the `rustc` crate.
#
# tl;dr; this is not needed to get `rustc` to compile, but if you remove it then
# later crate stop compiling. If you can remove this and everything
# compiles, then please feel free to do so!
flate2 = "0.2"
6 changes: 6 additions & 0 deletions src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#![feature(discriminant_value)]
#![feature(sort_unstable)]
#![feature(trace_macros)]
#![feature(test)]

#![recursion_limit="256"]

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

extern crate serialize as rustc_serialize; // used by deriving

// Note that librustc doesn't actually depend on these crates, see the note in
// `Cargo.toml` for this crate about why these are here.
extern crate flate2;
extern crate test;

#[macro_use]
mod macros;

Expand Down
Loading

0 comments on commit 37a991a

Please sign in to comment.