From 4c21a3bc2afc5933f31f1368f6b3406c5f1bdeb3 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 19 Nov 2018 21:52:50 -0800 Subject: [PATCH] std: Depend directly on crates.io crates Ever since we added a Cargo-based build system for the compiler the standard library has always been a little special, it's never been able to depend on crates.io crates for runtime dependencies. This has been a result of various limitations, namely that Cargo doesn't understand that crates from crates.io depend on libcore, so Cargo tries to build crates before libcore is finished. I had an idea this afternoon, however, which lifts the strategy from #52919 to directly depend on crates.io crates from the standard library. After all is said and done this removes a whopping three submodules that we need to manage! The basic idea here is that for any crate `std` depends on it adds an *optional* dependency on an empty crate on crates.io, in this case named `rustc-std-workspace-core`. This crate is overridden via `[patch]` in this repository to point to a local crate we write, and *that* has a `path` dependency on libcore. Note that all `no_std` crates also depend on `compiler_builtins`, but if we're not using submodules we can publish `compiler_builtins` to crates.io and all crates can depend on it anyway! The basic strategy then looks like: * The standard library (or some transitive dep) decides to depend on a crate `foo`. * The standard library adds ```toml [dependencies] foo = { version = "0.1", features = ['rustc-dep-of-std'] } ``` * The crate `foo` has an optional dependency on `rustc-std-workspace-core` * The crate `foo` has an optional dependency on `compiler_builtins` * The crate `foo` has a feature `rustc-dep-of-std` which activates these crates and any other necessary infrastructure in the crate. A sample commit for `dlmalloc` [turns out to be quite simple][commit]. After that all `no_std` crates should largely build "as is" and still be publishable on crates.io! Notably they should be able to continue to use stable Rust if necessary, since the `rename-dependency` feature of Cargo is soon stabilizing. As a proof of concept, this commit removes the `dlmalloc`, `libcompiler_builtins`, and `libc` submodules from this repository. Long thorns in our side these are now gone for good and we can directly depend on crates.io! It's hoped that in the long term we can bring in other crates as necessary, but for now this is largely intended to simply make it easier to manage these crates and remove submodules. This should be a transparent non-breaking change for all users, but one possible stickler is that this almost for sure breaks out-of-tree `std`-building tools like `xargo` and `cargo-xbuild`. I think it should be relatively easy to get them working, however, as all that's needed is an entry in the `[patch]` section used to build the standard library. Hopefully we can work with these tools to solve this problem! [commit]: https://github.com/alexcrichton/dlmalloc-rs/commit/28ee12db813a3b650a7c25d1c36d2c17dcb88ae3 --- .gitmodules | 12 --- Cargo.lock | 85 ++++++++++--------- Cargo.toml | 4 + src/bootstrap/compile.rs | 5 +- src/bootstrap/dist.rs | 15 +--- src/bootstrap/lib.rs | 8 +- src/bootstrap/test.rs | 5 +- src/build_helper/lib.rs | 15 ++-- src/dlmalloc | 1 - src/liballoc/Cargo.toml | 4 +- src/liballoc/tests/binary_heap.rs | 4 +- src/liballoc/tests/slice.rs | 4 +- src/libcompiler_builtins | 1 - src/libcore/Cargo.toml | 2 +- src/libcore/tests/num/flt2dec/random.rs | 13 ++- src/libcore/tests/slice.rs | 6 +- src/liblibc | 1 - src/libpanic_abort/Cargo.toml | 4 +- src/libpanic_unwind/Cargo.toml | 4 +- src/libprofiler_builtins/Cargo.toml | 2 +- src/libprofiler_builtins/build.rs | 8 +- src/librustc_asan/Cargo.toml | 2 +- src/librustc_lsan/Cargo.toml | 2 +- src/librustc_msan/Cargo.toml | 2 +- src/librustc_resolve/diagnostics.rs | 6 +- src/librustc_tsan/Cargo.toml | 2 +- src/libstd/Cargo.toml | 10 +-- src/libstd/build.rs | 7 +- src/libstd/fs.rs | 2 +- src/libstd/primitive_docs.rs | 2 +- src/libstd/sys/unix/ext/fs.rs | 2 +- src/libunwind/Cargo.toml | 4 +- src/rust-sgx | 1 - src/rustc/compiler_builtins_shim/Cargo.toml | 40 --------- src/rustc/compiler_builtins_shim/build.rs | 15 ---- src/rustc/dlmalloc_shim/Cargo.toml | 14 --- src/rustc/fortanix-sgx-abi_shim/Cargo.toml | 14 --- src/rustc/libc_shim/Cargo.toml | 40 --------- src/stage0.txt | 2 +- src/test/incremental/foreign.rs | 2 +- .../c-link-to-rust-va-list-fn/checkrust.rs | 2 +- .../run-make-fulldeps/issue-25581/test.rs | 8 +- .../issue-26006/in/time/lib.rs | 2 +- .../run-make-fulldeps/link-path-order/main.rs | 2 +- src/test/run-pass-valgrind/osx-frameworks.rs | 2 +- src/test/run-pass/anon-extern-mod.rs | 2 +- .../array-slice-vec/vec-macro-no-std.rs | 2 +- .../anon-extern-mod-cross-crate-1.rs | 2 +- .../check_static_recursion_foreign_helper.rs | 2 +- src/test/run-pass/auxiliary/foreign_lib.rs | 2 +- src/test/run-pass/c-stack-as-value.rs | 2 +- src/test/run-pass/c-stack-returning-int64.rs | 2 +- .../check-static-recursion-foreign.rs | 2 +- src/test/run-pass/command-before-exec.rs | 2 +- .../anon-extern-mod-cross-crate-1.rs | 2 +- src/test/run-pass/core-run-destroy.rs | 2 +- .../anon-extern-mod-cross-crate-1.rs | 2 +- src/test/run-pass/env-funky-keys.rs | 2 +- src/test/run-pass/env-null-vars.rs | 2 +- .../auxiliary/extern-crosscrate-source.rs | 2 +- src/test/run-pass/extern/extern-call-deep.rs | 2 +- src/test/run-pass/extern/extern-call-deep2.rs | 2 +- .../run-pass/extern/extern-call-indirect.rs | 2 +- src/test/run-pass/extern/extern-call-scrub.rs | 2 +- src/test/run-pass/extern/extern-crosscrate.rs | 2 +- src/test/run-pass/fds-are-cloexec.rs | 2 +- .../run-pass/foreign/auxiliary/foreign_lib.rs | 2 +- .../foreign/foreign-call-no-runtime.rs | 2 +- .../run-pass/foreign/foreign-fn-linkname.rs | 2 +- src/test/run-pass/foreign/foreign-no-abi.rs | 2 +- src/test/run-pass/foreign/foreign2.rs | 2 +- src/test/run-pass/invalid_const_promotion.rs | 2 +- .../issues/issue-13259-windows-tcb-trash.rs | 2 +- src/test/run-pass/issues/issue-2214.rs | 2 +- src/test/run-pass/issues/issue-30490.rs | 2 +- src/test/run-pass/issues/issue-3656.rs | 2 +- src/test/run-pass/no-stdio.rs | 2 +- src/test/run-pass/out-of-stack.rs | 2 +- src/test/run-pass/rfcs/rfc-1014-2.rs | 2 +- src/test/run-pass/rfcs/rfc-1014.rs | 2 +- src/test/run-pass/segfault-no-out-of-stack.rs | 2 +- .../signal-alternate-stack-cleanup.rs | 2 +- .../run-pass/statics/static-mut-foreign.rs | 2 +- .../run-pass/wait-forked-but-failed-child.rs | 2 +- src/test/ui/error-codes/E0259.rs | 2 +- src/test/ui/extern/extern-const.fixed | 2 +- src/test/ui/extern/extern-const.rs | 2 +- src/test/ui/issues/issue-1251.rs | 2 +- src/test/ui/issues/issue-22034.rs | 2 +- src/test/ui/issues/issue-37887.stderr | 4 +- src/test/ui/lint/lint-ctypes.rs | 2 +- src/test/ui/non-copyable-void.rs | 2 +- src/test/ui/unnecessary-extern-crate.rs | 2 +- src/tools/rustc-std-workspace-core/Cargo.toml | 14 +++ src/tools/rustc-std-workspace-core/README.md | 29 +++++++ src/tools/rustc-std-workspace-core/lib.rs | 6 ++ src/tools/tidy/src/deps.rs | 1 + src/tools/tidy/src/lib.rs | 6 +- src/tools/tidy/src/pal.rs | 3 - 99 files changed, 231 insertions(+), 314 deletions(-) delete mode 160000 src/dlmalloc delete mode 160000 src/libcompiler_builtins delete mode 160000 src/liblibc delete mode 160000 src/rust-sgx delete mode 100644 src/rustc/compiler_builtins_shim/Cargo.toml delete mode 100644 src/rustc/compiler_builtins_shim/build.rs delete mode 100644 src/rustc/dlmalloc_shim/Cargo.toml delete mode 100644 src/rustc/fortanix-sgx-abi_shim/Cargo.toml delete mode 100644 src/rustc/libc_shim/Cargo.toml create mode 100644 src/tools/rustc-std-workspace-core/Cargo.toml create mode 100644 src/tools/rustc-std-workspace-core/README.md create mode 100644 src/tools/rustc-std-workspace-core/lib.rs diff --git a/.gitmodules b/.gitmodules index 3fc6e45db3e39..70164d48a307b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,9 +5,6 @@ [submodule "src/rust-installer"] path = src/tools/rust-installer url = https://github.com/rust-lang/rust-installer.git -[submodule "src/liblibc"] - path = src/liblibc - url = https://github.com/rust-lang/libc.git [submodule "src/doc/nomicon"] path = src/doc/nomicon url = https://github.com/rust-lang-nursery/nomicon.git @@ -23,9 +20,6 @@ [submodule "src/tools/rls"] path = src/tools/rls url = https://github.com/rust-lang-nursery/rls.git -[submodule "src/libcompiler_builtins"] - path = src/libcompiler_builtins - url = https://github.com/rust-lang-nursery/compiler-builtins.git [submodule "src/tools/clippy"] path = src/tools/clippy url = https://github.com/rust-lang-nursery/rust-clippy.git @@ -35,9 +29,6 @@ [submodule "src/tools/miri"] path = src/tools/miri url = https://github.com/solson/miri.git -[submodule "src/dlmalloc"] - path = src/dlmalloc - url = https://github.com/alexcrichton/dlmalloc-rs.git [submodule "src/doc/rust-by-example"] path = src/doc/rust-by-example url = https://github.com/rust-lang/rust-by-example.git @@ -67,6 +58,3 @@ [submodule "src/doc/edition-guide"] path = src/doc/edition-guide url = https://github.com/rust-lang-nursery/edition-guide -[submodule "src/rust-sgx"] - path = src/rust-sgx - url = https://github.com/fortanix/rust-sgx diff --git a/Cargo.lock b/Cargo.lock index c3c881259dbe6..d22a91073394a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,9 +15,9 @@ dependencies = [ name = "alloc" version = "0.0.0" dependencies = [ - "compiler_builtins 0.0.0", + "compiler_builtins 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "core 0.0.0", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -407,10 +407,11 @@ dependencies = [ [[package]] name = "compiler_builtins" -version = "0.0.0" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "core 0.0.0", + "rustc-std-workspace-core 1.0.0", ] [[package]] @@ -456,7 +457,7 @@ dependencies = [ name = "core" version = "0.0.0" dependencies = [ - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -658,10 +659,12 @@ dependencies = [ [[package]] name = "dlmalloc" -version = "0.0.0" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "compiler_builtins 0.0.0", - "core 0.0.0", + "compiler_builtins 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-std-workspace-core 1.0.0", ] [[package]] @@ -814,10 +817,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "fortanix-sgx-abi" -version = "0.0.0" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "compiler_builtins 0.0.0", - "core 0.0.0", + "compiler_builtins 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-std-workspace-core 1.0.0", ] [[package]] @@ -1138,18 +1142,13 @@ name = "lazycell" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "libc" -version = "0.0.0" -dependencies = [ - "compiler_builtins 0.0.0", - "core 0.0.0", -] - [[package]] name = "libc" version = "0.2.45" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc-std-workspace-core 1.0.0", +] [[package]] name = "libgit2-sys" @@ -1520,9 +1519,9 @@ dependencies = [ name = "panic_abort" version = "0.0.0" dependencies = [ - "compiler_builtins 0.0.0", + "compiler_builtins 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "core 0.0.0", - "libc 0.0.0", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1530,9 +1529,9 @@ name = "panic_unwind" version = "0.0.0" dependencies = [ "alloc 0.0.0", - "compiler_builtins 0.0.0", + "compiler_builtins 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "core 0.0.0", - "libc 0.0.0", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "unwind 0.0.0", ] @@ -1683,7 +1682,7 @@ name = "profiler_builtins" version = "0.0.0" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "compiler_builtins 0.0.0", + "compiler_builtins 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "core 0.0.0", ] @@ -1814,7 +1813,7 @@ name = "rand_chacha" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1836,7 +1835,7 @@ name = "rand_hc" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1861,7 +1860,7 @@ name = "rand_xorshift" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2242,6 +2241,13 @@ name = "rustc-serialize" version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rustc-std-workspace-core" +version = "1.0.0" +dependencies = [ + "core 0.0.0", +] + [[package]] name = "rustc-workspace-hack" version = "1.0.0" @@ -2284,7 +2290,7 @@ dependencies = [ "alloc 0.0.0", "build_helper 0.1.0", "cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", - "compiler_builtins 0.0.0", + "compiler_builtins 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "core 0.0.0", ] @@ -2479,7 +2485,7 @@ dependencies = [ "alloc 0.0.0", "build_helper 0.1.0", "cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", - "compiler_builtins 0.0.0", + "compiler_builtins 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "core 0.0.0", ] @@ -2531,7 +2537,7 @@ dependencies = [ "alloc 0.0.0", "build_helper 0.1.0", "cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", - "compiler_builtins 0.0.0", + "compiler_builtins 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "core 0.0.0", ] @@ -2644,7 +2650,7 @@ dependencies = [ "alloc 0.0.0", "build_helper 0.1.0", "cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", - "compiler_builtins 0.0.0", + "compiler_builtins 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "core 0.0.0", ] @@ -2877,15 +2883,15 @@ dependencies = [ "alloc 0.0.0", "build_helper 0.1.0", "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "compiler_builtins 0.0.0", + "compiler_builtins 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "core 0.0.0", - "dlmalloc 0.0.0", - "fortanix-sgx-abi 0.0.0", - "libc 0.0.0", + "dlmalloc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fortanix-sgx-abi 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "panic_abort 0.0.0", "panic_unwind 0.0.0", "profiler_builtins 0.0.0", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_asan 0.0.0", "rustc_lsan 0.0.0", "rustc_msan 0.0.0", @@ -3217,9 +3223,9 @@ dependencies = [ name = "unwind" version = "0.0.0" dependencies = [ - "compiler_builtins 0.0.0", + "compiler_builtins 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "core 0.0.0", - "libc 0.0.0", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3397,6 +3403,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b0aa3473e85a3161b59845d6096b289bb577874cafeaf75ea1b1beaa6572c7fc" "checksum commoncrypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d056a8586ba25a1e4d61cb090900e495952c7886786fc55f909ab2f819b69007" "checksum commoncrypto-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fed34f46747aa73dfaa578069fd8279d2818ade2b55f38f22a9401c7f4083e2" +"checksum compiler_builtins 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8ad611263b9f31bdb66e66227d3b781600fd1e68d5deee29b23f5e2ac9cb4892" "checksum compiletest_rs 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "89747fe073b7838343bd2c2445e7a7c2e0d415598f8925f0fa9205b9cdfc48cb" "checksum core-foundation 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4e2640d6d0bf22e82bed1b73c6aef8d5dd31e5abe6666c57e6d45e2649f4f887" "checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" @@ -3418,6 +3425,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a" "checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" "checksum directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "72d337a64190607d4fcca2cb78982c5dd57f4916e19696b48a575fa746b6cb0f" +"checksum dlmalloc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c46c65de42b063004b31c67a98abe071089b289ff0919c660ed7ff4f59317f8" "checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" "checksum elasticlunr-rs 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a99a310cd1f9770e7bf8e48810c7bcbb0e078c8fb23a8c7bcf0da4c2bf61a455" "checksum ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f56c93cc076508c549d9bb747f79aa9b4eb098be7b8cad8830c3137ef52d1e00" @@ -3434,6 +3442,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" "checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +"checksum fortanix-sgx-abi 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "26105e20b4c3f7a319db1376b54ac9a46e5761e949405553375095d05a0cee4d" "checksum fs2 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" "checksum fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674" "checksum fst 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d94485a00b1827b861dd9d1a2cc9764f9044d4c535514c0760a5a2012ef3399f" diff --git a/Cargo.toml b/Cargo.toml index b763caa97d7ca..667c55791bd17 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -65,6 +65,10 @@ rustfmt-nightly = { path = "src/tools/rustfmt" } # here rustc-workspace-hack = { path = 'src/tools/rustc-workspace-hack' } +# See comments in `tools/rustc-std-workspace-core/README.md` for what's going on +# here +rustc-std-workspace-core = { path = 'src/tools/rustc-std-workspace-core' } + [patch."https://github.com/rust-lang/rust-clippy"] clippy_lints = { path = "src/tools/clippy/clippy_lints" } rustc_tools_util = { path = "src/tools/clippy/rustc_tools_util" } diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 2e792b6053ea3..c84abe42a6372 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -152,11 +152,10 @@ pub fn std_cargo(builder: &Builder, if builder.no_std(target) == Some(true) { // for no-std targets we only compile a few no_std crates - cargo.arg("--features").arg("c mem") + cargo .args(&["-p", "alloc"]) - .args(&["-p", "compiler_builtins"]) .arg("--manifest-path") - .arg(builder.src.join("src/rustc/compiler_builtins_shim/Cargo.toml")); + .arg(builder.src.join("src/liballoc/Cargo.toml")); } else { let features = builder.std_features(); diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 1ae494bfd44c8..f03eefb7a129b 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -857,12 +857,9 @@ impl Step for Src { // (essentially libstd and all of its path dependencies) let std_src_dirs = [ "src/build_helper", - "src/dlmalloc", "src/liballoc", "src/libbacktrace", - "src/libcompiler_builtins", "src/libcore", - "src/liblibc", "src/libpanic_abort", "src/libpanic_unwind", "src/librustc_asan", @@ -871,21 +868,15 @@ impl Step for Src { "src/librustc_tsan", "src/libstd", "src/libunwind", - "src/rustc/compiler_builtins_shim", - "src/rustc/libc_shim", - "src/rustc/dlmalloc_shim", - "src/rustc/fortanix-sgx-abi_shim", "src/libtest", "src/libterm", "src/libprofiler_builtins", "src/stdsimd", "src/libproc_macro", - ]; - let std_src_dirs_exclude = [ - "src/libcompiler_builtins/compiler-rt/test", + "src/tools/rustc-std-workspace-core", ]; - copy_src_dirs(builder, &std_src_dirs[..], &std_src_dirs_exclude[..], &dst_src); + copy_src_dirs(builder, &std_src_dirs[..], &[], &dst_src); for file in src_files.iter() { builder.copy(&builder.src.join(file), &dst_src.join(file)); } @@ -909,7 +900,7 @@ impl Step for Src { } } -const CARGO_VENDOR_VERSION: &str = "0.1.19"; +const CARGO_VENDOR_VERSION: &str = "0.1.22"; #[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)] pub struct PlainSourceTarball; diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index c31db48dc7e47..c8792918db2e2 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -1134,10 +1134,10 @@ impl Build { let krate = &self.crates[&krate]; if krate.is_local(self) { ret.push(krate); - for dep in &krate.deps { - if visited.insert(dep) && dep != "build_helper" { - list.push(*dep); - } + } + for dep in &krate.deps { + if visited.insert(dep) && dep != "build_helper" { + list.push(*dep); } } } diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index ca9894f8f6220..dc061fe5099a5 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1558,10 +1558,7 @@ impl Step for Crate { let builder = run.builder; run = run.krate("test"); for krate in run.builder.in_tree_crates("std") { - if krate.is_local(&run.builder) - && !(krate.name.starts_with("rustc_") && krate.name.ends_with("san")) - && krate.name != "dlmalloc" - { + if !(krate.name.starts_with("rustc_") && krate.name.ends_with("san")) { run = run.path(krate.local_path(&builder).to_str().unwrap()); } } diff --git a/src/build_helper/lib.rs b/src/build_helper/lib.rs index 0cbb08023615f..a580a874b3341 100644 --- a/src/build_helper/lib.rs +++ b/src/build_helper/lib.rs @@ -224,14 +224,12 @@ impl Drop for NativeLibBoilerplate { // Timestamps are created automatically when the result of `native_lib_boilerplate` goes out // of scope, so all the build actions should be completed until then. pub fn native_lib_boilerplate( - src_name: &str, + src_dir: &Path, out_name: &str, link_name: &str, search_subdir: &str, ) -> Result { - let current_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); - let src_dir = current_dir.join("..").join(src_name); - rerun_if_changed_anything_in_dir(&src_dir); + rerun_if_changed_anything_in_dir(src_dir); let out_dir = env::var_os("RUSTBUILD_NATIVE_DIR").unwrap_or_else(|| env::var_os("OUT_DIR").unwrap()); @@ -248,9 +246,9 @@ pub fn native_lib_boilerplate( ); let timestamp = out_dir.join("rustbuild.timestamp"); - if !up_to_date(Path::new("build.rs"), ×tamp) || !up_to_date(&src_dir, ×tamp) { + if !up_to_date(Path::new("build.rs"), ×tamp) || !up_to_date(src_dir, ×tamp) { Ok(NativeLibBoilerplate { - src_dir: src_dir, + src_dir: src_dir.to_path_buf(), out_dir: out_dir, }) } else { @@ -279,8 +277,11 @@ pub fn sanitizer_lib_boilerplate(sanitizer_name: &str) } else { format!("static={}", link_name) }; + // The source for `compiler-rt` comes from the `compiler-builtins` crate, so + // load our env var set by cargo to find the source code. + let dir = env::var_os("DEP_COMPILER_RT_COMPILER_RT").unwrap(); let lib = native_lib_boilerplate( - "libcompiler_builtins/compiler-rt", + dir.as_ref(), sanitizer_name, &to_link, search_path, diff --git a/src/dlmalloc b/src/dlmalloc deleted file mode 160000 index de99f4b0c886f..0000000000000 --- a/src/dlmalloc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit de99f4b0c886f5916cd1a146464276d65bef61b8 diff --git a/src/liballoc/Cargo.toml b/src/liballoc/Cargo.toml index 642a43d4d9c2b..b7faee1bc7da4 100644 --- a/src/liballoc/Cargo.toml +++ b/src/liballoc/Cargo.toml @@ -11,10 +11,10 @@ path = "lib.rs" [dependencies] core = { path = "../libcore" } -compiler_builtins = { path = "../rustc/compiler_builtins_shim" } +compiler_builtins = { version = "0.1.0", features = ['rustc-dep-of-std'] } [dev-dependencies] -rand = "0.5" +rand = "0.6" [[test]] name = "collectionstests" diff --git a/src/liballoc/tests/binary_heap.rs b/src/liballoc/tests/binary_heap.rs index b0d8fa6bd6936..536291de8f006 100644 --- a/src/liballoc/tests/binary_heap.rs +++ b/src/liballoc/tests/binary_heap.rs @@ -14,7 +14,7 @@ use std::collections::binary_heap::{Drain, PeekMut}; use std::panic::{self, AssertUnwindSafe}; use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; -use rand::{thread_rng, Rng}; +use rand::{thread_rng, seq::SliceRandom}; #[test] fn test_iterator() { @@ -332,7 +332,7 @@ fn panic_safe() { let panic_item = PanicOrd(i, true); // heapify the sane items - rng.shuffle(&mut panic_ords); + panic_ords.shuffle(&mut rng); let mut heap = BinaryHeap::from(panic_ords); let inner_data; diff --git a/src/liballoc/tests/slice.rs b/src/liballoc/tests/slice.rs index 787e4952882e9..6f31e6ca1a1bd 100644 --- a/src/liballoc/tests/slice.rs +++ b/src/liballoc/tests/slice.rs @@ -18,7 +18,7 @@ use std::sync::atomic::Ordering::Relaxed; use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize}; use std::thread; -use rand::{Rng, RngCore, thread_rng}; +use rand::{Rng, RngCore, thread_rng, seq::SliceRandom}; use rand::distributions::Standard; fn square(n: usize) -> usize { @@ -459,7 +459,7 @@ fn test_sort() { for i in 0..v.len() { v[i] = i as i32; } - v.sort_by(|_, _| *rng.choose(&[Less, Equal, Greater]).unwrap()); + v.sort_by(|_, _| *[Less, Equal, Greater].choose(&mut rng).unwrap()); v.sort(); for i in 0..v.len() { assert_eq!(v[i], i as i32); diff --git a/src/libcompiler_builtins b/src/libcompiler_builtins deleted file mode 160000 index 10f4f35f9670b..0000000000000 --- a/src/libcompiler_builtins +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 10f4f35f9670bb29715a8c1ec01284852d47ed35 diff --git a/src/libcore/Cargo.toml b/src/libcore/Cargo.toml index 7fd61f07d5e7f..fa2ab11243b6c 100644 --- a/src/libcore/Cargo.toml +++ b/src/libcore/Cargo.toml @@ -20,7 +20,7 @@ name = "corebenches" path = "../libcore/benches/lib.rs" [dev-dependencies] -rand = "0.5" +rand = "0.6" [features] # Make panics and failed asserts immediately abort without formatting any message diff --git a/src/libcore/tests/num/flt2dec/random.rs b/src/libcore/tests/num/flt2dec/random.rs index 95dfcb522e0a9..21a7c9fc6b337 100644 --- a/src/libcore/tests/num/flt2dec/random.rs +++ b/src/libcore/tests/num/flt2dec/random.rs @@ -18,7 +18,8 @@ use core::num::flt2dec::strategy::grisu::format_exact_opt; use core::num::flt2dec::strategy::grisu::format_shortest_opt; use core::num::flt2dec::{decode, DecodableFloat, FullDecoded, Decoded}; -use rand::{FromEntropy, XorShiftRng}; +use rand::FromEntropy; +use rand::rngs::SmallRng; use rand::distributions::{Distribution, Uniform}; pub fn decode_finite(v: T) -> Decoded { @@ -71,7 +72,10 @@ fn iterate(func: &str, k: usize, n: usize, mut f: F, mut g: G, mut v: V pub fn f32_random_equivalence_test(f: F, g: G, k: usize, n: usize) where F: FnMut(&Decoded, &mut [u8]) -> Option<(usize, i16)>, G: FnMut(&Decoded, &mut [u8]) -> (usize, i16) { - let mut rng = XorShiftRng::from_entropy(); + if cfg!(target_os = "emscripten") { + return // using rng pulls in i128 support, which doesn't work + } + let mut rng = SmallRng::from_entropy(); let f32_range = Uniform::new(0x0000_0001u32, 0x7f80_0000); iterate("f32_random_equivalence_test", k, n, f, g, |_| { let x = f32::from_bits(f32_range.sample(&mut rng)); @@ -82,7 +86,10 @@ pub fn f32_random_equivalence_test(f: F, g: G, k: usize, n: usize) pub fn f64_random_equivalence_test(f: F, g: G, k: usize, n: usize) where F: FnMut(&Decoded, &mut [u8]) -> Option<(usize, i16)>, G: FnMut(&Decoded, &mut [u8]) -> (usize, i16) { - let mut rng = XorShiftRng::from_entropy(); + if cfg!(target_os = "emscripten") { + return // using rng pulls in i128 support, which doesn't work + } + let mut rng = SmallRng::from_entropy(); let f64_range = Uniform::new(0x0000_0000_0000_0001u64, 0x7ff0_0000_0000_0000); iterate("f64_random_equivalence_test", k, n, f, g, |_| { let x = f64::from_bits(f64_range.sample(&mut rng)); diff --git a/src/libcore/tests/slice.rs b/src/libcore/tests/slice.rs index dba5a43eb21da..4f00ebee1d227 100644 --- a/src/libcore/tests/slice.rs +++ b/src/libcore/tests/slice.rs @@ -1024,11 +1024,11 @@ fn test_rotate_right() { fn sort_unstable() { use core::cmp::Ordering::{Equal, Greater, Less}; use core::slice::heapsort; - use rand::{FromEntropy, Rng, XorShiftRng}; + use rand::{FromEntropy, Rng, rngs::SmallRng, seq::SliceRandom}; let mut v = [0; 600]; let mut tmp = [0; 600]; - let mut rng = XorShiftRng::from_entropy(); + let mut rng = SmallRng::from_entropy(); for len in (2..25).chain(500..510) { let v = &mut v[0..len]; @@ -1073,7 +1073,7 @@ fn sort_unstable() { for i in 0..v.len() { v[i] = i as i32; } - v.sort_unstable_by(|_, _| *rng.choose(&[Less, Equal, Greater]).unwrap()); + v.sort_unstable_by(|_, _| *[Less, Equal, Greater].choose(&mut rng).unwrap()); v.sort_unstable(); for i in 0..v.len() { assert_eq!(v[i], i as i32); diff --git a/src/liblibc b/src/liblibc deleted file mode 160000 index 5b403753da9ec..0000000000000 --- a/src/liblibc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5b403753da9ec8ff501adf34cb6d63b319b4a3ae diff --git a/src/libpanic_abort/Cargo.toml b/src/libpanic_abort/Cargo.toml index 633d273b3b93c..e304e61c32936 100644 --- a/src/libpanic_abort/Cargo.toml +++ b/src/libpanic_abort/Cargo.toml @@ -11,5 +11,5 @@ doc = false [dependencies] core = { path = "../libcore" } -libc = { path = "../rustc/libc_shim" } -compiler_builtins = { path = "../rustc/compiler_builtins_shim" } +libc = { version = "0.2", default-features = false } +compiler_builtins = "0.1.0" diff --git a/src/libpanic_unwind/Cargo.toml b/src/libpanic_unwind/Cargo.toml index 74aaa4d5ae3db..c9fce621608a2 100644 --- a/src/libpanic_unwind/Cargo.toml +++ b/src/libpanic_unwind/Cargo.toml @@ -12,6 +12,6 @@ doc = false [dependencies] alloc = { path = "../liballoc" } core = { path = "../libcore" } -libc = { path = "../rustc/libc_shim" } +libc = { version = "0.2", default-features = false } unwind = { path = "../libunwind" } -compiler_builtins = { path = "../rustc/compiler_builtins_shim" } +compiler_builtins = "0.1.0" diff --git a/src/libprofiler_builtins/Cargo.toml b/src/libprofiler_builtins/Cargo.toml index 79192fbb6819c..7c95cf0a0542a 100644 --- a/src/libprofiler_builtins/Cargo.toml +++ b/src/libprofiler_builtins/Cargo.toml @@ -13,7 +13,7 @@ doc = false [dependencies] core = { path = "../libcore" } -compiler_builtins = { path = "../rustc/compiler_builtins_shim" } +compiler_builtins = { version = "0.1.0", features = ['rustc-dep-of-std'] } [build-dependencies] cc = "1.0.1" diff --git a/src/libprofiler_builtins/build.rs b/src/libprofiler_builtins/build.rs index 8d6c7d68dfe23..db72ce77e720b 100644 --- a/src/libprofiler_builtins/build.rs +++ b/src/libprofiler_builtins/build.rs @@ -56,9 +56,15 @@ fn main() { cfg.define("COMPILER_RT_HAS_UNAME", Some("1")); } + // The source for `compiler-rt` comes from the `compiler-builtins` crate, so + // load our env var set by cargo to find the source code. + let root = env::var_os("DEP_COMPILER_RT_COMPILER_RT").unwrap(); + let root = Path::new(&root); + for src in profile_sources { - cfg.file(Path::new("../libcompiler_builtins/compiler-rt/lib/profile").join(src)); + cfg.file(root.join("lib").join("profile").join(src)); } + cfg.warnings(false); cfg.compile("profiler-rt"); } diff --git a/src/librustc_asan/Cargo.toml b/src/librustc_asan/Cargo.toml index 734564c2d8567..836caf22abfa5 100644 --- a/src/librustc_asan/Cargo.toml +++ b/src/librustc_asan/Cargo.toml @@ -16,4 +16,4 @@ cmake = "0.1.18" [dependencies] alloc = { path = "../liballoc" } core = { path = "../libcore" } -compiler_builtins = { path = "../rustc/compiler_builtins_shim" } +compiler_builtins = "0.1.0" diff --git a/src/librustc_lsan/Cargo.toml b/src/librustc_lsan/Cargo.toml index 2573825a5ff45..a8e11df7670cf 100644 --- a/src/librustc_lsan/Cargo.toml +++ b/src/librustc_lsan/Cargo.toml @@ -16,4 +16,4 @@ cmake = "0.1.18" [dependencies] alloc = { path = "../liballoc" } core = { path = "../libcore" } -compiler_builtins = { path = "../rustc/compiler_builtins_shim" } +compiler_builtins = "0.1.0" diff --git a/src/librustc_msan/Cargo.toml b/src/librustc_msan/Cargo.toml index 29165675a2ad7..78c39d03e45a9 100644 --- a/src/librustc_msan/Cargo.toml +++ b/src/librustc_msan/Cargo.toml @@ -16,4 +16,4 @@ cmake = "0.1.18" [dependencies] alloc = { path = "../liballoc" } core = { path = "../libcore" } -compiler_builtins = { path = "../rustc/compiler_builtins_shim" } +compiler_builtins = "0.1.0" diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 2681295cf9bf1..7730239071410 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -295,9 +295,8 @@ that has been imported into the current module. Erroneous code example: ```compile_fail,E0259 -# #![feature(libc)] extern crate core; -extern crate libc as core; +extern crate std as core; fn main() {} ``` @@ -308,9 +307,8 @@ external crate imported into the current module. Correct example: ``` -# #![feature(libc)] extern crate core; -extern crate libc as other_name; +extern crate std as other_name; fn main() {} ``` diff --git a/src/librustc_tsan/Cargo.toml b/src/librustc_tsan/Cargo.toml index baadb64511ae1..f0618275f2f6a 100644 --- a/src/librustc_tsan/Cargo.toml +++ b/src/librustc_tsan/Cargo.toml @@ -16,4 +16,4 @@ cmake = "0.1.18" [dependencies] alloc = { path = "../liballoc" } core = { path = "../libcore" } -compiler_builtins = { path = "../rustc/compiler_builtins_shim" } +compiler_builtins = "0.1.0" diff --git a/src/libstd/Cargo.toml b/src/libstd/Cargo.toml index 274d5bec6622f..41e778b6a4c72 100644 --- a/src/libstd/Cargo.toml +++ b/src/libstd/Cargo.toml @@ -17,13 +17,13 @@ alloc = { path = "../liballoc" } panic_unwind = { path = "../libpanic_unwind", optional = true } panic_abort = { path = "../libpanic_abort" } core = { path = "../libcore" } -libc = { path = "../rustc/libc_shim" } -compiler_builtins = { path = "../rustc/compiler_builtins_shim" } +libc = { version = "0.2.44", default-features = false, features = ['rustc-dep-of-std'] } +compiler_builtins = { version = "0.1.1" } profiler_builtins = { path = "../libprofiler_builtins", optional = true } unwind = { path = "../libunwind" } [dev-dependencies] -rand = "0.5" +rand = "0.6.1" [target.x86_64-apple-darwin.dependencies] rustc_asan = { path = "../librustc_asan" } @@ -36,10 +36,10 @@ rustc_msan = { path = "../librustc_msan" } rustc_tsan = { path = "../librustc_tsan" } [target.'cfg(any(all(target_arch = "wasm32", not(target_os = "emscripten")), target_env = "sgx"))'.dependencies] -dlmalloc = { path = '../rustc/dlmalloc_shim' } +dlmalloc = { version = "0.1", features = ['rustc-dep-of-std'] } [target.x86_64-fortanix-unknown-sgx.dependencies] -fortanix-sgx-abi = { path = "../rustc/fortanix-sgx-abi_shim" } +fortanix-sgx-abi = { version = "0.3.1", features = ['rustc-dep-of-std'] } [build-dependencies] cc = "1.0" diff --git a/src/libstd/build.rs b/src/libstd/build.rs index 9d6e8c4cafdcb..2386f134b9026 100644 --- a/src/libstd/build.rs +++ b/src/libstd/build.rs @@ -82,7 +82,12 @@ fn main() { } fn build_libbacktrace(target: &str) -> Result<(), ()> { - let native = native_lib_boilerplate("libbacktrace", "libbacktrace", "backtrace", "")?; + let native = native_lib_boilerplate( + "../libbacktrace".as_ref(), + "libbacktrace", + "backtrace", + "", + )?; let mut build = cc::Build::new(); build diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index b6a0ce6372086..d581ba1de23f2 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -2089,7 +2089,7 @@ mod tests { use fs::{self, File, OpenOptions}; use io::{ErrorKind, SeekFrom}; use path::Path; - use rand::{StdRng, FromEntropy, RngCore}; + use rand::{rngs::StdRng, FromEntropy, RngCore}; use str; use sys_common::io::test::{TempDir, tmpdir}; use thread; diff --git a/src/libstd/primitive_docs.rs b/src/libstd/primitive_docs.rs index 3b2366a9eca9d..7c1654f62fa5a 100644 --- a/src/libstd/primitive_docs.rs +++ b/src/libstd/primitive_docs.rs @@ -426,7 +426,7 @@ mod prim_unit { } /// ## 3. Get it from C. /// /// ``` -/// # #![feature(libc)] +/// # #![feature(rustc_private)] /// extern crate libc; /// /// use std::mem; diff --git a/src/libstd/sys/unix/ext/fs.rs b/src/libstd/sys/unix/ext/fs.rs index 7e65bbdef2a96..af2f1998415ee 100644 --- a/src/libstd/sys/unix/ext/fs.rs +++ b/src/libstd/sys/unix/ext/fs.rs @@ -348,7 +348,7 @@ pub trait OpenOptionsExt { /// # Examples /// /// ```no_run - /// # #![feature(libc)] + /// # #![feature(rustc_private)] /// extern crate libc; /// use std::fs::OpenOptions; /// use std::os::unix::fs::OpenOptionsExt; diff --git a/src/libunwind/Cargo.toml b/src/libunwind/Cargo.toml index 4760461df64e3..2577d6dd31d8f 100644 --- a/src/libunwind/Cargo.toml +++ b/src/libunwind/Cargo.toml @@ -13,5 +13,5 @@ doc = false [dependencies] core = { path = "../libcore" } -libc = { path = "../rustc/libc_shim" } -compiler_builtins = { path = "../rustc/compiler_builtins_shim" } +libc = { version = "0.2.43", features = ['rustc-dep-of-std'], default-features = false } +compiler_builtins = "0.1.0" diff --git a/src/rust-sgx b/src/rust-sgx deleted file mode 160000 index 9656260888095..0000000000000 --- a/src/rust-sgx +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9656260888095f44830641ca7bb3da609a793451 diff --git a/src/rustc/compiler_builtins_shim/Cargo.toml b/src/rustc/compiler_builtins_shim/Cargo.toml deleted file mode 100644 index 9804177280f66..0000000000000 --- a/src/rustc/compiler_builtins_shim/Cargo.toml +++ /dev/null @@ -1,40 +0,0 @@ -[package] -name = "compiler_builtins" -authors = ["The Rust Project Developers"] -version = "0.0.0" -build = "../../libcompiler_builtins/build.rs" - -[lib] -path = "../../libcompiler_builtins/src/lib.rs" -test = false -doctest = false - -[dependencies] -# Specify the path to libcore; at the time of writing, removing this shim in -# favor of using compiler-builtins from git results in a compilation failure: -# -# Building stage0 std artifacts (x86_64-apple-darwin -> x86_64-apple-darwin) -# Compiling compiler_builtins v0.1.0 (https://github.com/rust-lang-nursery/compiler-builtins.git#23f14d3f) -# error[E0463]: can't find crate for `core` -# -# error: aborting due to previous error -# -# error: Could not compile `compiler_builtins`. -# -# Caused by: -# process didn't exit successfully: `/Users/tamird/src/rust/build/bootstrap/debug/rustc --crate-name compiler_builtins /Users/tamird/.cargo/git/checkouts/compiler-builtins-ec094dc45a0179c8/23f14d3/src/lib.rs --error-format json --crate-type lib --emit=dep-info,link -C opt-level=2 --cfg feature="c" --cfg feature="compiler-builtins" --cfg feature="default" --cfg feature="gcc" -C metadata=876d429e8d7eae1f -C extra-filename=-876d429e8d7eae1f --out-dir /Users/tamird/src/rust/build/x86_64-apple-darwin/stage0-std/x86_64-apple-darwin/release/deps --target x86_64-apple-darwin -L dependency=/Users/tamird/src/rust/build/x86_64-apple-darwin/stage0-std/x86_64-apple-darwin/release/deps -L dependency=/Users/tamird/src/rust/build/x86_64-apple-darwin/stage0-std/release/deps --cap-lints allow -L native=/Users/tamird/src/rust/build/x86_64-apple-darwin/stage0-std/x86_64-apple-darwin/release/build/compiler_builtins-f18fab55928102ad/out -l static=compiler-rt` (exit code: 101) -# thread 'main' panicked at 'command did not execute successfully: "/Users/tamird/src/rust/build/x86_64-apple-darwin/stage0/bin/cargo" "build" "-j" "4" "--target" "x86_64-apple-darwin" "--release" "--features" "panic-unwind jemalloc backtrace" "--manifest-path" "/Users/tamird/src/rust/src/libstd/Cargo.toml" "--message-format" "json" -# expected success, got: exit code: 101', src/bootstrap/compile.rs:883:8 -# -# See https://github.com/rust-lang/rfcs/pull/1133. -core = { path = "../../libcore" } - -[build-dependencies] -cc = "1.0.1" - -[features] -c = [] -default = ["rustbuild", "compiler-builtins"] -mem = [] -rustbuild = [] -compiler-builtins = [] diff --git a/src/rustc/compiler_builtins_shim/build.rs b/src/rustc/compiler_builtins_shim/build.rs deleted file mode 100644 index b37543e5f679d..0000000000000 --- a/src/rustc/compiler_builtins_shim/build.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// This file is left intentionally empty (and not removed) to avoid an issue -// where this crate is always considered dirty due to compiler-builtins' -// `cargo:rerun-if-changed=build.rs` directive; since the path is relative, it -// refers to this file when this shim crate is being built, and the absence of -// this file is considered by cargo to be equivalent to it having changed. diff --git a/src/rustc/dlmalloc_shim/Cargo.toml b/src/rustc/dlmalloc_shim/Cargo.toml deleted file mode 100644 index b6f8550829fe0..0000000000000 --- a/src/rustc/dlmalloc_shim/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "dlmalloc" -version = "0.0.0" -authors = ["The Rust Project Developers"] - -[lib] -path = "../../dlmalloc/src/lib.rs" -test = false -bench = false -doc = false - -[dependencies] -core = { path = "../../libcore" } -compiler_builtins = { path = "../../rustc/compiler_builtins_shim" } diff --git a/src/rustc/fortanix-sgx-abi_shim/Cargo.toml b/src/rustc/fortanix-sgx-abi_shim/Cargo.toml deleted file mode 100644 index fd81d3db3a79b..0000000000000 --- a/src/rustc/fortanix-sgx-abi_shim/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "fortanix-sgx-abi" -version = "0.0.0" -authors = ["The Rust Project Developers"] - -[lib] -path = "../../rust-sgx/fortanix-sgx-abi/src/lib.rs" -test = false -bench = false -doc = false - -[dependencies] -core = { path = "../../libcore" } -compiler_builtins = { path = "../../rustc/compiler_builtins_shim" } diff --git a/src/rustc/libc_shim/Cargo.toml b/src/rustc/libc_shim/Cargo.toml deleted file mode 100644 index ee037ac68c59b..0000000000000 --- a/src/rustc/libc_shim/Cargo.toml +++ /dev/null @@ -1,40 +0,0 @@ -[package] -name = "libc" -version = "0.0.0" -authors = ["The Rust Project Developers"] - -[lib] -name = "libc" -path = "../../liblibc/src/lib.rs" -test = false -bench = false -doc = false - -[dependencies] -# Specify the path to libcore; at the time of writing, removing this shim in -# favor of using libc from git results in a compilation failure: -# -# Building stage0 std artifacts (x86_64-apple-darwin -> x86_64-apple-darwin) -# Compiling libc v0.0.0 (file:///Users/tamird/src/rust/src/rustc/libc_shim) -# error[E0463]: can't find crate for `core` -# -# error: aborting due to previous error -# -# error: Could not compile `libc`. -# -# Caused by: -# process didn't exit successfully: `/Users/tamird/src/rust/build/bootstrap/debug/rustc --crate-name libc src/rustc/libc_shim/../../liblibc/src/lib.rs --error-format json --crate-type lib --emit=dep-info,link -C opt-level=2 --cfg feature="default" --cfg feature="no_std" --cfg feature="stdbuild" -C metadata=d758f87058112d7d -C extra-filename=-d758f87058112d7d --out-dir /Users/tamird/src/rust/build/x86_64-apple-darwin/stage0-std/x86_64-apple-darwin/release/deps --target x86_64-apple-darwin -L dependency=/Users/tamird/src/rust/build/x86_64-apple-darwin/stage0-std/x86_64-apple-darwin/release/deps -L dependency=/Users/tamird/src/rust/build/x86_64-apple-darwin/stage0-std/release/deps` (exit code: 101) -# thread 'main' panicked at 'command did not execute successfully: "/Users/tamird/src/rust/build/x86_64-apple-darwin/stage0/bin/cargo" "build" "-j" "4" "--target" "x86_64-apple-darwin" "--release" "--features" "panic-unwind jemalloc backtrace" "--manifest-path" "/Users/tamird/src/rust/src/libstd/Cargo.toml" "--message-format" "json" -# expected success, got: exit code: 101', src/bootstrap/compile.rs:883:8 -# -# See https://github.com/rust-lang/rfcs/pull/1133. -core = { path = "../../libcore" } -compiler_builtins = { path = "../compiler_builtins_shim" } - - -[features] -# Certain parts of libc are conditionally compiled differently than when used -# outside rustc. See https://github.com/rust-lang/libc/search?l=Rust&q=stdbuild&type=&utf8=%E2%9C%93. -stdbuild = [] -default = ["stdbuild", "align"] -align = [] diff --git a/src/stage0.txt b/src/stage0.txt index 9326e22090c22..8369413777578 100644 --- a/src/stage0.txt +++ b/src/stage0.txt @@ -12,7 +12,7 @@ # source tarball for a stable release you'll likely see `1.x.0` for rustc and # `0.x.0` for Cargo where they were released on `date`. -date: 2018-10-30 +date: 2018-11-21 rustc: beta cargo: beta diff --git a/src/test/incremental/foreign.rs b/src/test/incremental/foreign.rs index dbdebefaf310b..648e89be037ff 100644 --- a/src/test/incremental/foreign.rs +++ b/src/test/incremental/foreign.rs @@ -13,7 +13,7 @@ // revisions: rpass1 -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs b/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs index 90ad6011526c1..0254c7cf40302 100644 --- a/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs +++ b/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs @@ -10,7 +10,7 @@ #![crate_type = "staticlib"] #![feature(c_variadic)] -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-make-fulldeps/issue-25581/test.rs b/src/test/run-make-fulldeps/issue-25581/test.rs index 6717d16cb7c41..b084092d727bb 100644 --- a/src/test/run-make-fulldeps/issue-25581/test.rs +++ b/src/test/run-make-fulldeps/issue-25581/test.rs @@ -8,14 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(libc)] - -extern crate libc; - #[link(name = "test", kind = "static")] extern { - fn slice_len(s: &[u8]) -> libc::size_t; - fn slice_elem(s: &[u8], idx: libc::size_t) -> u8; + fn slice_len(s: &[u8]) -> usize; + fn slice_elem(s: &[u8], idx: usize) -> u8; } fn main() { diff --git a/src/test/run-make-fulldeps/issue-26006/in/time/lib.rs b/src/test/run-make-fulldeps/issue-26006/in/time/lib.rs index b1d07d5733796..1427250b9f0a4 100644 --- a/src/test/run-make-fulldeps/issue-26006/in/time/lib.rs +++ b/src/test/run-make-fulldeps/issue-26006/in/time/lib.rs @@ -7,7 +7,7 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; fn main(){} diff --git a/src/test/run-make-fulldeps/link-path-order/main.rs b/src/test/run-make-fulldeps/link-path-order/main.rs index f3502e8bcd413..4d38dc8fa0fdb 100644 --- a/src/test/run-make-fulldeps/link-path-order/main.rs +++ b/src/test/run-make-fulldeps/link-path-order/main.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass-valgrind/osx-frameworks.rs b/src/test/run-pass-valgrind/osx-frameworks.rs index 468a20db6f74d..afa9374ff6733 100644 --- a/src/test/run-pass-valgrind/osx-frameworks.rs +++ b/src/test/run-pass-valgrind/osx-frameworks.rs @@ -11,7 +11,7 @@ // no-prefer-dynamic // pretty-expanded FIXME #23616 -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/anon-extern-mod.rs b/src/test/run-pass/anon-extern-mod.rs index 16ca7bce95b59..daa2bd6288230 100644 --- a/src/test/run-pass/anon-extern-mod.rs +++ b/src/test/run-pass/anon-extern-mod.rs @@ -11,7 +11,7 @@ // pretty-expanded FIXME #23616 // ignore-wasm32-bare no libc to test ffi with -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/array-slice-vec/vec-macro-no-std.rs b/src/test/run-pass/array-slice-vec/vec-macro-no-std.rs index 509167413b6f4..7a90a022e0a0b 100644 --- a/src/test/run-pass/array-slice-vec/vec-macro-no-std.rs +++ b/src/test/run-pass/array-slice-vec/vec-macro-no-std.rs @@ -12,7 +12,7 @@ // ignore-emscripten no no_std executables -#![feature(lang_items, start, libc, alloc)] +#![feature(lang_items, start, rustc_private, alloc)] #![no_std] extern crate std as other; diff --git a/src/test/run-pass/auxiliary/anon-extern-mod-cross-crate-1.rs b/src/test/run-pass/auxiliary/anon-extern-mod-cross-crate-1.rs index 741ce351da38e..6b464c59f2abc 100644 --- a/src/test/run-pass/auxiliary/anon-extern-mod-cross-crate-1.rs +++ b/src/test/run-pass/auxiliary/anon-extern-mod-cross-crate-1.rs @@ -9,7 +9,7 @@ // except according to those terms. #![crate_name="anonexternmod"] -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/auxiliary/check_static_recursion_foreign_helper.rs b/src/test/run-pass/auxiliary/check_static_recursion_foreign_helper.rs index cd36a8eedb482..4d1acf31be324 100644 --- a/src/test/run-pass/auxiliary/check_static_recursion_foreign_helper.rs +++ b/src/test/run-pass/auxiliary/check_static_recursion_foreign_helper.rs @@ -10,7 +10,7 @@ // Helper definition for test/run-pass/check-static-recursion-foreign.rs. -#![feature(libc)] +#![feature(rustc_private)] #![crate_name = "check_static_recursion_foreign_helper"] #![crate_type = "lib"] diff --git a/src/test/run-pass/auxiliary/foreign_lib.rs b/src/test/run-pass/auxiliary/foreign_lib.rs index cef36274c625e..465feb8eaf7c6 100644 --- a/src/test/run-pass/auxiliary/foreign_lib.rs +++ b/src/test/run-pass/auxiliary/foreign_lib.rs @@ -10,7 +10,7 @@ #![crate_name="foreign_lib"] -#![feature(libc)] +#![feature(rustc_private)] pub mod rustrt { extern crate libc; diff --git a/src/test/run-pass/c-stack-as-value.rs b/src/test/run-pass/c-stack-as-value.rs index df4989d89ab5e..1f29a5201bdca 100644 --- a/src/test/run-pass/c-stack-as-value.rs +++ b/src/test/run-pass/c-stack-as-value.rs @@ -11,7 +11,7 @@ // pretty-expanded FIXME #23616 // ignore-wasm32-bare no libc to test ffi with -#![feature(libc)] +#![feature(rustc_private)] mod rustrt { extern crate libc; diff --git a/src/test/run-pass/c-stack-returning-int64.rs b/src/test/run-pass/c-stack-returning-int64.rs index 56a0437146b9e..7dd3b9a7a5bf6 100644 --- a/src/test/run-pass/c-stack-returning-int64.rs +++ b/src/test/run-pass/c-stack-returning-int64.rs @@ -10,7 +10,7 @@ // ignore-wasm32-bare no libc to test with -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/check-static-recursion-foreign.rs b/src/test/run-pass/check-static-recursion-foreign.rs index a95870c2b27fe..15f509a1753dd 100644 --- a/src/test/run-pass/check-static-recursion-foreign.rs +++ b/src/test/run-pass/check-static-recursion-foreign.rs @@ -16,7 +16,7 @@ // pretty-expanded FIXME #23616 -#![feature(custom_attribute, libc)] +#![feature(custom_attribute, rustc_private)] extern crate check_static_recursion_foreign_helper; extern crate libc; diff --git a/src/test/run-pass/command-before-exec.rs b/src/test/run-pass/command-before-exec.rs index 5d8bc31c2a337..b78fa849d0d66 100644 --- a/src/test/run-pass/command-before-exec.rs +++ b/src/test/run-pass/command-before-exec.rs @@ -13,7 +13,7 @@ // ignore-cloudabi no processes // ignore-emscripten no processes -#![feature(process_exec, libc)] +#![feature(process_exec, rustc_private)] extern crate libc; diff --git a/src/test/run-pass/consts/auxiliary/anon-extern-mod-cross-crate-1.rs b/src/test/run-pass/consts/auxiliary/anon-extern-mod-cross-crate-1.rs index 741ce351da38e..6b464c59f2abc 100644 --- a/src/test/run-pass/consts/auxiliary/anon-extern-mod-cross-crate-1.rs +++ b/src/test/run-pass/consts/auxiliary/anon-extern-mod-cross-crate-1.rs @@ -9,7 +9,7 @@ // except according to those terms. #![crate_name="anonexternmod"] -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/core-run-destroy.rs b/src/test/run-pass/core-run-destroy.rs index 51e26ff68de7e..902332656a803 100644 --- a/src/test/run-pass/core-run-destroy.rs +++ b/src/test/run-pass/core-run-destroy.rs @@ -20,7 +20,7 @@ // memory, which makes for some *confusing* logs. That's why these are here // instead of in std. -#![feature(libc, duration)] +#![feature(rustc_private, duration)] extern crate libc; diff --git a/src/test/run-pass/cross-crate/auxiliary/anon-extern-mod-cross-crate-1.rs b/src/test/run-pass/cross-crate/auxiliary/anon-extern-mod-cross-crate-1.rs index 741ce351da38e..6b464c59f2abc 100644 --- a/src/test/run-pass/cross-crate/auxiliary/anon-extern-mod-cross-crate-1.rs +++ b/src/test/run-pass/cross-crate/auxiliary/anon-extern-mod-cross-crate-1.rs @@ -9,7 +9,7 @@ // except according to those terms. #![crate_name="anonexternmod"] -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/env-funky-keys.rs b/src/test/run-pass/env-funky-keys.rs index 12e1cbe97d83c..7e7899cf1518a 100644 --- a/src/test/run-pass/env-funky-keys.rs +++ b/src/test/run-pass/env-funky-keys.rs @@ -16,7 +16,7 @@ // ignore-emscripten no execve // no-prefer-dynamic -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/env-null-vars.rs b/src/test/run-pass/env-null-vars.rs index 9a461991c1e62..cdbecf120c3e5 100644 --- a/src/test/run-pass/env-null-vars.rs +++ b/src/test/run-pass/env-null-vars.rs @@ -15,7 +15,7 @@ // issue-53200 -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; use std::env; diff --git a/src/test/run-pass/extern/auxiliary/extern-crosscrate-source.rs b/src/test/run-pass/extern/auxiliary/extern-crosscrate-source.rs index 150dffeea886c..d20d9dbac3d2c 100644 --- a/src/test/run-pass/extern/auxiliary/extern-crosscrate-source.rs +++ b/src/test/run-pass/extern/auxiliary/extern-crosscrate-source.rs @@ -10,7 +10,7 @@ #![crate_name="externcallback"] #![crate_type = "lib"] -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/extern/extern-call-deep.rs b/src/test/run-pass/extern/extern-call-deep.rs index 6e8d94becbd9e..f6eff601c4b7a 100644 --- a/src/test/run-pass/extern/extern-call-deep.rs +++ b/src/test/run-pass/extern/extern-call-deep.rs @@ -11,7 +11,7 @@ // run-pass // ignore-wasm32-bare no libc to test ffi with -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/extern/extern-call-deep2.rs b/src/test/run-pass/extern/extern-call-deep2.rs index 28157c5a8d5e9..8cb04771cb93a 100644 --- a/src/test/run-pass/extern/extern-call-deep2.rs +++ b/src/test/run-pass/extern/extern-call-deep2.rs @@ -12,7 +12,7 @@ #![allow(unused_must_use)] // ignore-emscripten no threads support -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; use std::thread; diff --git a/src/test/run-pass/extern/extern-call-indirect.rs b/src/test/run-pass/extern/extern-call-indirect.rs index 1badb10364eb6..d20721f2c9194 100644 --- a/src/test/run-pass/extern/extern-call-indirect.rs +++ b/src/test/run-pass/extern/extern-call-indirect.rs @@ -11,7 +11,7 @@ // run-pass // ignore-wasm32-bare no libc to test ffi with -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/extern/extern-call-scrub.rs b/src/test/run-pass/extern/extern-call-scrub.rs index ea18069fa32fc..5e158c2dfc970 100644 --- a/src/test/run-pass/extern/extern-call-scrub.rs +++ b/src/test/run-pass/extern/extern-call-scrub.rs @@ -16,7 +16,7 @@ // ignore-emscripten no threads support -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; use std::thread; diff --git a/src/test/run-pass/extern/extern-crosscrate.rs b/src/test/run-pass/extern/extern-crosscrate.rs index c6fccbe003c5d..b99e27af920b2 100644 --- a/src/test/run-pass/extern/extern-crosscrate.rs +++ b/src/test/run-pass/extern/extern-crosscrate.rs @@ -12,7 +12,7 @@ // aux-build:extern-crosscrate-source.rs // ignore-wasm32-bare no libc to test ffi with -#![feature(libc)] +#![feature(rustc_private)] extern crate externcallback; extern crate libc; diff --git a/src/test/run-pass/fds-are-cloexec.rs b/src/test/run-pass/fds-are-cloexec.rs index a5ae0ae9f3155..33e64d832fc64 100644 --- a/src/test/run-pass/fds-are-cloexec.rs +++ b/src/test/run-pass/fds-are-cloexec.rs @@ -14,7 +14,7 @@ // ignore-emscripten no processes // ignore-haiku -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/foreign/auxiliary/foreign_lib.rs b/src/test/run-pass/foreign/auxiliary/foreign_lib.rs index cef36274c625e..465feb8eaf7c6 100644 --- a/src/test/run-pass/foreign/auxiliary/foreign_lib.rs +++ b/src/test/run-pass/foreign/auxiliary/foreign_lib.rs @@ -10,7 +10,7 @@ #![crate_name="foreign_lib"] -#![feature(libc)] +#![feature(rustc_private)] pub mod rustrt { extern crate libc; diff --git a/src/test/run-pass/foreign/foreign-call-no-runtime.rs b/src/test/run-pass/foreign/foreign-call-no-runtime.rs index 4837f78ce3b01..e35ec88213252 100644 --- a/src/test/run-pass/foreign/foreign-call-no-runtime.rs +++ b/src/test/run-pass/foreign/foreign-call-no-runtime.rs @@ -11,7 +11,7 @@ // run-pass // ignore-emscripten no threads support -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/foreign/foreign-fn-linkname.rs b/src/test/run-pass/foreign/foreign-fn-linkname.rs index 75876607603d1..8fe90b7d49880 100644 --- a/src/test/run-pass/foreign/foreign-fn-linkname.rs +++ b/src/test/run-pass/foreign/foreign-fn-linkname.rs @@ -11,7 +11,7 @@ // run-pass // ignore-wasm32-bare no libc to test ffi with -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; use std::ffi::CString; diff --git a/src/test/run-pass/foreign/foreign-no-abi.rs b/src/test/run-pass/foreign/foreign-no-abi.rs index 1d35f08a11fdb..49ddd09beee49 100644 --- a/src/test/run-pass/foreign/foreign-no-abi.rs +++ b/src/test/run-pass/foreign/foreign-no-abi.rs @@ -14,7 +14,7 @@ // ignore-wasm32-bare no libc to test ffi with // pretty-expanded FIXME #23616 -#![feature(libc)] +#![feature(rustc_private)] mod rustrt { extern crate libc; diff --git a/src/test/run-pass/foreign/foreign2.rs b/src/test/run-pass/foreign/foreign2.rs index bd6c8e6b53d60..f8942bc171252 100644 --- a/src/test/run-pass/foreign/foreign2.rs +++ b/src/test/run-pass/foreign/foreign2.rs @@ -13,7 +13,7 @@ // ignore-wasm32-bare no libc to test ffi with // pretty-expanded FIXME #23616 -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/invalid_const_promotion.rs b/src/test/run-pass/invalid_const_promotion.rs index 0f354e1aad6c9..3b8a265dd70a5 100644 --- a/src/test/run-pass/invalid_const_promotion.rs +++ b/src/test/run-pass/invalid_const_promotion.rs @@ -15,7 +15,7 @@ // compile-flags: -C debug_assertions=yes #![stable(feature = "rustc", since = "1.0.0")] -#![feature(const_fn, libc, staged_api, rustc_attrs)] +#![feature(const_fn, rustc_private, staged_api, rustc_attrs)] #![allow(const_err)] extern crate libc; diff --git a/src/test/run-pass/issues/issue-13259-windows-tcb-trash.rs b/src/test/run-pass/issues/issue-13259-windows-tcb-trash.rs index de18e09532bb1..9c983eab7d833 100644 --- a/src/test/run-pass/issues/issue-13259-windows-tcb-trash.rs +++ b/src/test/run-pass/issues/issue-13259-windows-tcb-trash.rs @@ -9,7 +9,7 @@ // except according to those terms. // run-pass -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/issues/issue-2214.rs b/src/test/run-pass/issues/issue-2214.rs index 8329847d3c5f3..f3795c216c85c 100644 --- a/src/test/run-pass/issues/issue-2214.rs +++ b/src/test/run-pass/issues/issue-2214.rs @@ -11,7 +11,7 @@ // run-pass // ignore-wasm32-bare no libc to test ffi with -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/issues/issue-30490.rs b/src/test/run-pass/issues/issue-30490.rs index 500999cc1cf18..47f60fb93d784 100644 --- a/src/test/run-pass/issues/issue-30490.rs +++ b/src/test/run-pass/issues/issue-30490.rs @@ -18,7 +18,7 @@ // where the descriptors to inherit were already stdio descriptors. // This test checks to avoid that regression. -#![cfg_attr(unix, feature(libc))] +#![cfg_attr(unix, feature(rustc_private))] #![cfg_attr(windows, allow(unused_imports))] #[cfg(unix)] diff --git a/src/test/run-pass/issues/issue-3656.rs b/src/test/run-pass/issues/issue-3656.rs index 63b27406198cd..99a72444d73a6 100644 --- a/src/test/run-pass/issues/issue-3656.rs +++ b/src/test/run-pass/issues/issue-3656.rs @@ -19,7 +19,7 @@ // pretty-expanded FIXME #23616 // ignore-wasm32-bare no libc to test with -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; use libc::{c_uint, uint32_t, c_void}; diff --git a/src/test/run-pass/no-stdio.rs b/src/test/run-pass/no-stdio.rs index d34241769603b..2f5bfbb501fd1 100644 --- a/src/test/run-pass/no-stdio.rs +++ b/src/test/run-pass/no-stdio.rs @@ -12,7 +12,7 @@ // ignore-cloudabi no processes // ignore-emscripten no processes -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/out-of-stack.rs b/src/test/run-pass/out-of-stack.rs index cd0f7cdbf6dab..1c714e7f7fa18 100644 --- a/src/test/run-pass/out-of-stack.rs +++ b/src/test/run-pass/out-of-stack.rs @@ -16,7 +16,7 @@ // ignore-emscripten no processes #![feature(asm)] -#![feature(libc)] +#![feature(rustc_private)] #[cfg(unix)] extern crate libc; diff --git a/src/test/run-pass/rfcs/rfc-1014-2.rs b/src/test/run-pass/rfcs/rfc-1014-2.rs index 7fbc0d1db70de..257c7f546b1c7 100644 --- a/src/test/run-pass/rfcs/rfc-1014-2.rs +++ b/src/test/run-pass/rfcs/rfc-1014-2.rs @@ -11,7 +11,7 @@ // run-pass #![allow(dead_code)] -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/rfcs/rfc-1014.rs b/src/test/run-pass/rfcs/rfc-1014.rs index d101c3c9ab198..578a7f4395cc7 100644 --- a/src/test/run-pass/rfcs/rfc-1014.rs +++ b/src/test/run-pass/rfcs/rfc-1014.rs @@ -13,7 +13,7 @@ // ignore-cloudabi stdout does not map to file descriptor 1 by default // ignore-wasm32-bare no libc -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/segfault-no-out-of-stack.rs b/src/test/run-pass/segfault-no-out-of-stack.rs index a85fe6733dd80..961b8020f3d90 100644 --- a/src/test/run-pass/segfault-no-out-of-stack.rs +++ b/src/test/run-pass/segfault-no-out-of-stack.rs @@ -12,7 +12,7 @@ // ignore-cloudabi can't run commands // ignore-emscripten can't run commands -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/signal-alternate-stack-cleanup.rs b/src/test/run-pass/signal-alternate-stack-cleanup.rs index ad099f82d13b9..a79ab20c1605c 100644 --- a/src/test/run-pass/signal-alternate-stack-cleanup.rs +++ b/src/test/run-pass/signal-alternate-stack-cleanup.rs @@ -16,7 +16,7 @@ // ignore-wasm32-bare no libc // ignore-windows -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; use libc::*; diff --git a/src/test/run-pass/statics/static-mut-foreign.rs b/src/test/run-pass/statics/static-mut-foreign.rs index d9e43ddea7185..460d66a459264 100644 --- a/src/test/run-pass/statics/static-mut-foreign.rs +++ b/src/test/run-pass/statics/static-mut-foreign.rs @@ -15,7 +15,7 @@ // ignore-wasm32-bare no libc to test ffi with -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/wait-forked-but-failed-child.rs b/src/test/run-pass/wait-forked-but-failed-child.rs index dc47108e183df..d822b67a07c3b 100644 --- a/src/test/run-pass/wait-forked-but-failed-child.rs +++ b/src/test/run-pass/wait-forked-but-failed-child.rs @@ -11,7 +11,7 @@ // ignore-cloudabi no processes // ignore-emscripten no processes -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/ui/error-codes/E0259.rs b/src/test/ui/error-codes/E0259.rs index 5a47541c708be..b3e633a701776 100644 --- a/src/test/ui/error-codes/E0259.rs +++ b/src/test/ui/error-codes/E0259.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(alloc, libc)] +#![feature(alloc, rustc_private)] #![allow(unused_extern_crates)] extern crate alloc; diff --git a/src/test/ui/extern/extern-const.fixed b/src/test/ui/extern/extern-const.fixed index dca5698a70c20..fb17934fa9b21 100644 --- a/src/test/ui/extern/extern-const.fixed +++ b/src/test/ui/extern/extern-const.fixed @@ -7,7 +7,7 @@ // run-rustfix // ignore-wasm32 no external library to link to. // compile-flags: -g -Z continue-parse-after-error -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; #[link(name = "rust_test_helpers", kind = "static")] diff --git a/src/test/ui/extern/extern-const.rs b/src/test/ui/extern/extern-const.rs index 07dbe545a850a..f2585f5199ea6 100644 --- a/src/test/ui/extern/extern-const.rs +++ b/src/test/ui/extern/extern-const.rs @@ -7,7 +7,7 @@ // run-rustfix // ignore-wasm32 no external library to link to. // compile-flags: -g -Z continue-parse-after-error -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; #[link(name = "rust_test_helpers", kind = "static")] diff --git a/src/test/ui/issues/issue-1251.rs b/src/test/ui/issues/issue-1251.rs index b42404ce7739b..125f6e1faa669 100644 --- a/src/test/ui/issues/issue-1251.rs +++ b/src/test/ui/issues/issue-1251.rs @@ -14,7 +14,7 @@ // pretty-expanded FIXME #23616 // ignore-wasm32-bare no libc to test ffi with -#![feature(libc)] +#![feature(rustc_private)] #![crate_id="rust_get_test_int"] diff --git a/src/test/ui/issues/issue-22034.rs b/src/test/ui/issues/issue-22034.rs index 2708de2c13a8f..bee324f874613 100644 --- a/src/test/ui/issues/issue-22034.rs +++ b/src/test/ui/issues/issue-22034.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/ui/issues/issue-37887.stderr b/src/test/ui/issues/issue-37887.stderr index 48fb6c2e6faa7..7a5a5cde469e5 100644 --- a/src/test/ui/issues/issue-37887.stderr +++ b/src/test/ui/issues/issue-37887.stderr @@ -4,13 +4,13 @@ error[E0432]: unresolved import `libc` LL | use libc::*; //~ ERROR unresolved import | ^^^^ maybe a missing `extern crate libc;`? -error[E0658]: use of unstable library feature 'libc': use `libc` from crates.io (see issue #27783) +error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) --> $DIR/issue-37887.rs:12:5 | LL | extern crate libc; //~ ERROR use of unstable | ^^^^^^^^^^^^^^^^^^ | - = help: add #![feature(libc)] to the crate attributes to enable + = help: add #![feature(rustc_private)] to the crate attributes to enable error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/lint-ctypes.rs b/src/test/ui/lint/lint-ctypes.rs index e09aabaf69253..4c9f1f980bdb8 100644 --- a/src/test/ui/lint/lint-ctypes.rs +++ b/src/test/ui/lint/lint-ctypes.rs @@ -9,7 +9,7 @@ // except according to those terms. #![deny(improper_ctypes)] -#![feature(libc)] +#![feature(rustc_private)] #![allow(private_in_public)] diff --git a/src/test/ui/non-copyable-void.rs b/src/test/ui/non-copyable-void.rs index 63e5f963754e2..35991901e9309 100644 --- a/src/test/ui/non-copyable-void.rs +++ b/src/test/ui/non-copyable-void.rs @@ -10,7 +10,7 @@ // ignore-wasm32-bare no libc to test ffi with -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/ui/unnecessary-extern-crate.rs b/src/test/ui/unnecessary-extern-crate.rs index 110cfefcd92e5..4eb3c3d6436bb 100644 --- a/src/test/ui/unnecessary-extern-crate.rs +++ b/src/test/ui/unnecessary-extern-crate.rs @@ -11,7 +11,7 @@ // edition:2018 #![deny(unused_extern_crates)] -#![feature(alloc, test, libc, crate_visibility_modifier)] +#![feature(alloc, test, rustc_private, crate_visibility_modifier)] extern crate libc; //~^ ERROR unused extern crate diff --git a/src/tools/rustc-std-workspace-core/Cargo.toml b/src/tools/rustc-std-workspace-core/Cargo.toml new file mode 100644 index 0000000000000..f000d634e1943 --- /dev/null +++ b/src/tools/rustc-std-workspace-core/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "rustc-std-workspace-core" +version = "1.0.0" +authors = ["Alex Crichton "] +license = 'MIT/Apache-2.0' +description = """ +Hack for the compiler's own build system +""" + +[lib] +path = "lib.rs" + +[dependencies] +core = { path = "../../libcore" } diff --git a/src/tools/rustc-std-workspace-core/README.md b/src/tools/rustc-std-workspace-core/README.md new file mode 100644 index 0000000000000..9c2b1fa91d3b3 --- /dev/null +++ b/src/tools/rustc-std-workspace-core/README.md @@ -0,0 +1,29 @@ +# The `rustc-std-workspace-core` crate + +This crate is a shim and empty crate which simply depends on `libcore` and +reexports all of its contents. The crate is the crux of empowering the standard +library to depend on crates from crates.io + +Crates on crates.io that the standard library depend on the +`rustc-std-workspace-core` crate from crates.io. On crates.io, however, this +crate is empty. We use `[patch]` to override it to this crate in this +repository. As a result, crates on crates.io will draw a dependency edge to +`libcore`, the version defined in this repository. That should draw all the +dependency edges to ensure Cargo builds crates successfully! + +Note that crates on crates.io need to depend on this crate with the name `core` +for everything to work correctly. To do that they can use: + +```toml +core = { version = "1.0.0", optional = true, package = 'rustc-std-workspace-core' } +``` + +Through the use of the `package` key the crate is renamed to `core`, meaning +it'll look like + +``` +--extern core=.../librustc_std_workspace_core-XXXXXXX.rlib +``` + +when Cargo invokes the compiler, satisfying the implicit `extern crate core` +directive injected by the compiler. diff --git a/src/tools/rustc-std-workspace-core/lib.rs b/src/tools/rustc-std-workspace-core/lib.rs new file mode 100644 index 0000000000000..e2946fe2a97f1 --- /dev/null +++ b/src/tools/rustc-std-workspace-core/lib.rs @@ -0,0 +1,6 @@ +#![feature(no_core)] +#![no_core] + +extern crate core; + +pub use core::*; diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index e2758921f192a..2b5cff6e07b2a 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -53,6 +53,7 @@ const EXCEPTIONS: &[&str] = &[ "bytesize", // Apache-2.0, cargo "im-rc", // MPL-2.0+, cargo "adler32", // BSD-3-Clause AND Zlib, cargo dep that isn't used + "fortanix-sgx-abi", // MPL-2.0+, libstd but only for sgx target ]; /// Which crates to check against the whitelist? diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs index 53db589beaf46..614d2053a432b 100644 --- a/src/tools/tidy/src/lib.rs +++ b/src/tools/tidy/src/lib.rs @@ -56,15 +56,11 @@ pub mod libcoretest; fn filter_dirs(path: &Path) -> bool { let skip = [ - "src/dlmalloc", "src/llvm", "src/llvm-emscripten", "src/libbacktrace", - "src/libcompiler_builtins", "src/librustc_data_structures/owning_ref", - "src/compiler-rt", - "src/liblibc", - "src/rt/hoedown", + "src/vendor", "src/tools/cargo", "src/tools/clang", "src/tools/rls", diff --git a/src/tools/tidy/src/pal.rs b/src/tools/tidy/src/pal.rs index 822db25319138..acf72022c60ed 100644 --- a/src/tools/tidy/src/pal.rs +++ b/src/tools/tidy/src/pal.rs @@ -26,7 +26,6 @@ //! exceptions: //! //! - core may not have platform-specific code -//! - libcompiler_builtins may have platform-specific code //! - libpanic_abort may have platform-specific code //! - libpanic_unwind may have platform-specific code //! - libunwind may have platform-specific code @@ -50,8 +49,6 @@ use std::iter::Iterator; // Paths that may contain platform-specific code const EXCEPTION_PATHS: &[&str] = &[ // std crates - "src/libcompiler_builtins", - "src/liblibc", "src/libpanic_abort", "src/libpanic_unwind", "src/libunwind",