about summary refs log tree commit diff
path: root/src/rustc
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-56/+0
2020-01-09Remove unused dependenciesShotaro Yamada-1/+0
2019-12-22Format the worldMark Rousskov-12/+7
2019-12-11rustc: Link LLVM directly into rustc againAlex Crichton-0/+1
This commit builds on #65501 continue to simplify the build system and compiler now that we no longer have multiple LLVM backends to ship by default. Here this switches the compiler back to what it once was long long ago, which is linking LLVM directly to the compiler rather than dynamically loading it at runtime. The `codegen-backends` directory of the sysroot no longer exists and all relevant support in the build system is removed. Note that `rustc` still supports a dynamically loaded codegen backend as it did previously, it just no longer supports dynamically loaded codegen backends in its own sysroot. Additionally as part of this the `librustc_codegen_llvm` crate now once again explicitly depends on all of its crates instead of implicitly loading them through the sysroot. This involved filling out its `Cargo.toml` and deleting all the now-unnecessary `extern crate` annotations in the header of the crate. (this in turn required adding a number of imports for names of macros too). The end results of this change are: * Rustbuild's build process for the compiler as all the "oh don't forget the codegen backend" checks can be easily removed. * Building `rustc_codegen_llvm` is much simpler since it's simply another compiler crate. * Managing the dependencies of `rustc_codegen_llvm` is much simpler since it's "just another `Cargo.toml` to edit" * The build process should be a smidge faster because there's more parallelism in the main rustc build step rather than splitting `librustc_codegen_llvm` out to its own step. * The compiler is expected to be slightly faster by default because the codegen backend does not need to be dynamically loaded. * Disabling LLVM as part of rustbuild is still supported, supporting multiple codegen backends is still supported, and dynamic loading of a codegen backend is still supported.
2019-04-22Remove leading newlinesvarkor-1/+0
2019-03-26Update jemalloc-sys to version 0.3.0gnzlbg-1/+1
2019-03-10Make the rustc driver and interface demand drivenJohn Kåre Alsaker-11/+0
2019-01-03rustc: Fix regression where jemalloc isn't usedAlex Crichton-10/+32
In #56986 the linkage of jemalloc to the compiler was switched from the driver library to the rustc binary to ensure that only rustc itself uses jemalloc. In doing so, however, it turns out jemalloc wasn't actually linked in at all! None of the symbols were referenced so the static library wasn't used. This means that jemalloc wasn't pulled in at all. This commit performs a bit of a dance to reference jemalloc symbols, attempting to pull it in despite LLVM's optimizations. Closes #57115
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-19rustc: Move jemalloc from rustc_driver to rustcAlex Crichton-1/+14
This commit moves jemalloc to just the rustc binary rather than the rustc_driver shared library, enusring that it's only used for binaries that opt-in to it like rustc rather than other binaries using librustc_driver like rustdoc/rls/etc. This will hopefully address #56980
2018-12-11std: Depend directly on crates.io cratesAlex Crichton-123/+0
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
2018-12-07Add x86_64-fortanix-unknown-sgx target to libstd and dependenciesJethro Beekman-0/+14
The files src/libstd/sys/sgx/*.rs are mostly copied/adapted from the wasm target. This also updates the dlmalloc submodule to the very latest version.
2018-12-02explicitly control compiler_builts/c feature from libstdRalf Jung-1/+1
2018-11-22Move fake rustc_codegen_ssa dependency from rustc_driver to rustc-mainbjorn3-0/+4
2018-11-02Use `jemalloc-sys` on Linux and OSX compilersAlex Crichton-0/+3
This commit adds opt-in support to the compiler to link to `jemalloc` in the compiler. When activated the compiler will depend on `jemalloc-sys`, instruct jemalloc to unprefix its symbols, and then link to it. The feature is activated by default on Linux/OSX compilers for x86_64/i686 platforms, and it's not enabled anywhere else for now. We may be able to opt-in other platforms in the future! Also note that the opt-in only happens on CI, it's otherwise unconditionally turned off by default. Closes #36963
2018-11-02Remove all jemalloc-related contentAlex Crichton-3/+0
This commit removes all jemalloc related submodules, configuration, etc, from the bootstrap, from the standard library, and from the compiler. This will be followed up with a change to use jemalloc specifically as part of rustc on blessed platforms.
2018-08-08Update libc and activate align featureLinus Färnstrand-1/+2
2018-05-17Fix rustc binary metadata overwriting librustc metadataMark Simulacrum-1/+1
In #49289, rustc was changed to emit metadata for binaries, which made it so that the librustc.rmeta file created when compiling librustc was overwritten by the rustc-main compilation. This commit renames the rustc-main binary to avoid this problem. https://github.com/rust-lang/cargo/issues/5524 has also been filed to see if Cargo can learn to warn on this situation instead of leaving it for the user to debug.
2018-04-26Rename rustc_back::target to rustc_target::spec.Irina Popa-2/+2
2018-04-17Rollup merge of #49606 - varkor:pipe-repair, r=alexcrichtonkennytm-1/+4
Prevent broken pipes causing ICEs As the private `std::io::print_to` panics if there is an I/O error, which is used by `println!`, the compiler would ICE if one attempted to use a broken pipe (e.g. `rustc --help | false`). This introduces a new (private) macro `try_println!` which allows us to avoid this. As a side note, it seems this macro might be useful publicly (and actually there seems to be [a crate specifically for this purpose](https://crates.io/crates/try_print/)), though that can probably be left for a future discussion. One slight alternative approach would be to simply early exit without an error (i.e. exit code `0`), which [this comment](https://github.com/rust-lang/rust/issues/34376#issuecomment-377822526) suggests is the usual approach. I've opted not to take that approach initially, because I think it's more helpful to know when there is a broken pipe. Fixes #34376.
2018-04-12Update to most recent version of dlmallocAlex Crichton-1/+0
Inline the definition of `GlobalAlloc` for `dlmalloc` on wasm and don't rely on usage of unstable features in `dlmalloc` itself.
2018-04-11Prevent EPIPE causing ICEs in rustc and rustdocvarkor-1/+4
2018-04-10Allow incorrectly reported unused attribute warningMark Simulacrum-0/+1
2018-04-07Inject the `compiler_builtins` crate whenever the `core` crate is injectedOliver Schneider-0/+3
2018-04-05Rollup merge of #49563 - japaric:std-thumb, r=alexcrichtonkennytm-0/+1
add a dist builder to build rust-std components for the THUMB targets the rust-std component only contains the core and compiler-builtins (+c +mem) crates cc #49382 - I'm not entirely sure if this PR alone will produce rust-std components installable by rustup or if something else needs to be changed - I could have done the THUMB builds in an existing builder / image; I wasn't sure if that was a good idea so I added a new image - I could build other crates like alloc into the rust-std component but, AFAICT, that would require calling Cargo a second time (one for alloc and one for compiler-builtins), or have alloc depend on compiler-builtins (#49503 will perform that change) *and* have alloc resurface the "c" and "mem" Cargo features. r? @alexcrichton
2018-04-01add a dist-thumb builder to build rust-std for the THUMB targetsJorge Aparicio-0/+1
the rust-std component only contains the core and compiler-builtins (+c +mem) crates cc #49382
2018-03-28Set link args for rustdocTatsuyuki Ishi-0/+1
2018-03-18rustc_driver: get rid of extra thread on WindowsTatsuyuki Ishi-0/+9
2018-01-27rustc: Load the `rustc_trans` crate at runtimeAlex Crichton-3/+0
Building on the work of # 45684 this commit updates the compiler to unconditionally load the `rustc_trans` crate at runtime instead of linking to it at compile time. The end goal of this work is to implement # 46819 where rustc will have multiple backends available to it to load. This commit starts off by removing the `extern crate rustc_trans` from the driver. This involved moving some miscellaneous functionality into the `TransCrate` trait and also required an implementation of how to locate and load the trans backend. This ended up being a little tricky because the sysroot isn't always the right location (for example `--sysroot` arguments) so some extra code was added as well to probe a directory relative to the current dll (the rustc_driver dll). Rustbuild has been updated accordingly as well to have a separate compilation invocation for the `rustc_trans` crate and assembly it accordingly into the sysroot. Finally, the distribution logic for the `rustc` package was also updated to slurp up the trans backends folder. A number of assorted fallout changes were included here as well to ensure tests pass and such, and they should all be commented inline.
2017-11-19std: Add a new wasm32-unknown-unknown targetAlex Crichton-0/+14
This commit adds a new target to the compiler: wasm32-unknown-unknown. This target is a reimagining of what it looks like to generate WebAssembly code from Rust. Instead of using Emscripten which can bring with it a weighty runtime this instead is a target which uses only the LLVM backend for WebAssembly and a "custom linker" for now which will hopefully one day be direct calls to lld. Notable features of this target include: * There is zero runtime footprint. The target assumes nothing exists other than the wasm32 instruction set. * There is zero toolchain footprint beyond adding the target. No custom linker is needed, rustc contains everything. * Very small wasm modules can be generated directly from Rust code using this target. * Most of the standard library is stubbed out to return an error, but anything related to allocation works (aka `HashMap`, `Vec`, etc). * Naturally, any `#[no_std]` crate should be 100% compatible with this new target. This target is currently somewhat janky due to how linking works. The "linking" is currently unconditional whole program LTO (aka LLVM is being used as a linker). Naturally that means compiling programs is pretty slow! Eventually though this target should have a linker. This target is also intended to be quite experimental. I'm hoping that this can act as a catalyst for further experimentation in Rust with WebAssembly. Breaking changes are very likely to land to this target, so it's not recommended to rely on it in any critical capacity yet. We'll let you know when it's "production ready". --- Currently testing-wise this target is looking pretty good but isn't complete. I've got almost the entire `run-pass` test suite working with this target (lots of tests ignored, but many passing as well). The `core` test suite is still getting LLVM bugs fixed to get that working and will take some time. Relatively simple programs all seem to work though! --- It's worth nothing that you may not immediately see the "smallest possible wasm module" for the input you feed to rustc. For various reasons it's very difficult to get rid of the final "bloat" in vanilla rustc (again, a real linker should fix all this). For now what you'll have to do is: cargo install --git https://github.com/alexcrichton/wasm-gc wasm-gc foo.wasm bar.wasm And then `bar.wasm` should be the smallest we can get it! --- In any case for now I'd love feedback on this, particularly on the various integration points if you've got better ideas of how to approach them!
2017-10-11Bump cc to 1.01 to include x86_64-unknown-linux-gnux32 supportMarco A L Barbosa-1/+1
2017-10-06Trim and document compiler-builtins shimTamir Duberstein-10/+22
2017-09-30Update the libcompiler_builtins submoduleest31-1/+1
2017-09-21Trim and document libc shimTamir Duberstein-27/+23
2017-08-11Make librustc_driver work without librustc_transbjorn3-0/+1
2017-07-27Build rustdoc on-demand.Mark Simulacrum-20/+0
Rustdoc is no longer compiled in every stage, alongside rustc, instead it is only compiled when requested, and generally only for the last stage.
2017-07-05Switch to rust-lang-nursery/compiler-builtinsAlex Crichton-0/+42
This commit migrates the in-tree `libcompiler_builtins` to the upstream version at https://github.com/rust-lang-nursery/compiler-builtins. The upstream version has a number of intrinsics written in Rust and serves as an in-progress rewrite of compiler-rt into Rust. Additionally it also contains all the existing intrinsics defined in `libcompiler_builtins` for 128-bit integers. It's been the intention since the beginning to make this transition but previously it just lacked the manpower to get done. As this PR likely shows it wasn't a trivial integration! Some highlight changes are: * The PR rust-lang-nursery/compiler-builtins#166 contains a number of fixes across platforms and also some refactorings to make the intrinsics easier to read. The additional testing added there also fixed a number of integration issues when pulling the repository into this tree. * LTO with the compiler-builtins crate was fixed to link in the entire crate after the LTO process as these intrinsics are excluded from LTO. * Treatment of hidden symbols was updated as previously the `#![compiler_builtins]` crate would mark all symbol *imports* as hidden whereas it was only intended to mark *exports* as hidden.
2017-03-28Fix plain_summary_line functionGuillaume Gomez-1/+0
2017-03-28Add feature for rustdoc binaryGuillaume Gomez-0/+1
2017-02-21test: Verify all sysroot crates are unstableAlex Crichton-94/+0
As we continue to add more crates to the compiler and use them to implement various features we want to be sure we're not accidentally expanding the API surface area of the compiler! To that end this commit adds a new `run-make` test which will attempt to `extern crate foo` all crates in the sysroot, verifying that they're all unstable. This commit discovered that the `std_shim` and `test_shim` crates were accidentally stable and fixes the situation by deleting those shims. The shims are no longer necessary due to changes in Cargo that have happened since they were originally incepted.
2017-02-08sanitizer supportJorge Aparicio-0/+4
2017-02-02Fixup crate versionsVadim Petrochenkov-2/+2
2017-01-16Expose a feature to force use of alloc_system, teach rustbuildAidan Hobson Sayers-0/+1
This fixes jemalloc-less local rebuilds, where we tell cargo that we're actually stage1
2016-12-30std: Don't build docs for misc facade cratesAlex Crichton-0/+2
Retain the same behavior as stable. Closes #38319
2016-11-30Update the bootstrap compilerAlex Crichton-33/+0
Now that we've got a beta build, let's use it!
2016-11-26Auto merge of #38008 - bluss:rustbuild-benches, r=alexcrichtonbors-0/+1
Add rustbuild command `bench` Add command bench to rustbuild, so that `./x.py bench <path>` can compile and run benchmarks. `./x.py bench --stage 1 src/libcollections` and `./x.py bench --stage 1 src/libstd` should both compile well. Just `./x.py bench` runs all benchmarks for the libstd crates. Fixes #37897
2016-11-26rustbuild: Add bench = false to std shim cratesUlrik Sverdrup-0/+1
2016-11-23std: make compilation of libpanic_unwind optional via a Cargo featureJorge Aparicio-2/+3
with this feature disabled, you can (Cargo) compile std with "panic=abort" rustbuild will build std with this feature enabled, to maintain the status quo fixes #37252
2016-10-07Use workspaces and switch to a single Cargo.lock.Ahmed Charles-568/+0
This involves hacking the code used to run cargo test on various packages, because it reads Cargo.lock to determine which packages should be tested. This change implements a blacklist, since that will catch new crates when they are added in the future.
2016-10-06rustc: Rename rustc_macro to proc_macroAlex Crichton-10/+10
This commit blanket renames the `rustc_macro` infrastructure to `proc_macro`, which reflects the general consensus of #35900. A follow up PR to Cargo will be required to purge the `rustc-macro` name as well.