about summary refs log tree commit diff
path: root/src/librustc/middle/dependency_format.rs
AgeCommit message (Collapse)AuthorLines
2019-02-05move librustc to 2018Mark Mansi-6/+6
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-2/+2
2018-11-30Statically link proc_macro into proc macros.Eduard-Mihai Burtescu-3/+2
2018-11-11rustc: Clean up allocator injection logicAlex Crichton-15/+0
This commit cleans up allocator injection logic found in the compiler around selecting the global allocator. It turns out that now that jemalloc is gone the compiler never actually injects anything! This means that basically everything around loading crates here and there can be easily pruned. This also removes the `exe_allocation_crate` option from custom target specs as it's no longer used by the compiler anywhere.
2018-10-29Improve a few cases of collecting to an FxHash(Map/Set)ljedrz-4/+3
2018-10-19Deprecate the `FxHashMap()` and `FxHashSet()` constructor function hackOliver Scherer-2/+2
2018-10-06rustc/middle: whitespace & formatting fixesljedrz-2/+2
2018-10-06rustc/middle: improve some patternsljedrz-1/+1
2018-09-29don't elide lifetimes in paths in librustc/Zack M. Davis-1/+1
This seemed like a good way to kick the tires on the elided-lifetimes-in-paths lint (#52069)—seems to work! This was also pretty tedious—it sure would be nice if `cargo fix` worked on this codebase (#53896)!
2018-08-04Normalize variants of CrateType to standard styleMark Rousskov-10/+10
This is a clippy-breaking change.
2018-05-17Rename trans to codegen everywhere.Irina Popa-1/+1
2018-04-26Rename rustc_back::target to rustc_target::spec.Irina Popa-1/+1
2018-04-26rustc_back: move LinkerFlavor, PanicStrategy, and RelroLevel to target.Irina Popa-1/+1
2018-04-10Make Session.injected_panic_runtime thread-safeJohn Kåre Alsaker-2/+2
2018-04-10Make Session.dependency_formats thread-safeJohn Kåre Alsaker-1/+2
2018-03-02Run Rustfix on librustcManish Goregaokar-1/+1
2017-09-19Adjust dependency-resolution errors to be more consistentSamuel Holland-5/+5
2017-09-18Require rlibs for dependent crates when linking static executablesSamuel Holland-34/+42
This handles the case for `CrateTypeExecutable` and `+crt_static`. I reworked the match block to avoid duplicating the `attempt_static` and error checking code again (this case would have been a copy of the `CrateTypeCdylib`/`CrateTypeStaticlib` case). On `linux-musl` targets where `std` was built with `crt_static = false` in `config.toml`, this change brings the test suite from entirely failing to mostly passing. This change should not affect behavior for other crate types, or for targets which do not respect `+crt_static`.
2017-09-07rustc: Remove `CrateStore::crates` as a methodAlex Crichton-5/+5
This commit moves the `crates` method to a query and then migrates all callers to use a query instead of the now-renamed `crates_untracked` method where possible. Closes #41417
2017-09-05rustc: Remove `CrateStore::used_crate*`Alex Crichton-6/+6
This commit removes the `use_crates` and `used_crate_source` methods in favor of a mix of queries and helper methods being used now instead.
2017-09-05rustc: Flag some CrateStore methods as "untracked"Alex Crichton-20/+19
The main use of `CrateStore` *before* the `TyCtxt` is created is during resolution, but we want to be sure that any methods used before resolution are not used after the `TyCtxt` is created. This commit starts moving the methods used by resolve to all be named `{name}_untracked` where the rest of the compiler uses just `{name}` as a query. During this transition a number of new queries were added to account for post-resolve usage of these methods.
2017-09-05rustc: Move a few more cstore methods to queriesAlex Crichton-7/+7
This comit applies the following changes: * Deletes the `is_allocator` query as it's no longer used * Moves the `is_sanitizer_runtime` method to a query * Moves the `is_profiler_runtime` method to a query * Moves the `panic_strategy` method to a query * Moves the `is_no_builtins` method to a query * Deletes the cstore method of `is_compiler_builtins`. The query was added in #42588 but the `CrateStore` method was not deleted A good bit of these methods were used late in linking during trans so a new dedicated structure was created to ship a calculated form of this information over to the linker rather than having to ship the whole of `TyCtxt` over to linking.
2017-07-16Compile `compiler_builtins` with `abort` panic strategyVadim Petrochenkov-1/+2
2017-07-05rustc: Implement the #[global_allocator] attributeAlex Crichton-15/+14
This PR is an implementation of [RFC 1974] which specifies a new method of defining a global allocator for a program. This obsoletes the old `#![allocator]` attribute and also removes support for it. [RFC 1974]: https://github.com/rust-lang/rfcs/pull/197 The new `#[global_allocator]` attribute solves many issues encountered with the `#![allocator]` attribute such as composition and restrictions on the crate graph itself. The compiler now has much more control over the ABI of the allocator and how it's implemented, allowing much more freedom in terms of how this feature is implemented. cc #27389
2017-06-14Switch CrateNum queries to DefIdTaylor Cramer-7/+7
2017-06-14On-demandify is_allocator and is_panic_runtimeTaylor Cramer-12/+14
2017-06-14on-demand dylib dependency formatsTaylor Cramer-6/+11
2016-12-29Support --emit=foo,metadataNick Cameron-1/+1
2016-12-29Change --crate-type metadata to --emit=metadataNick Cameron-1/+5
2016-11-28Avoid loading needless proc-macro dependencies.Jeffrey Seyfried-2/+2
2016-11-21Read in rmeta cratesNick Cameron-1/+1
2016-11-21Add --crate-type metadataNick Cameron-1/+1
With the same semantics as -Zno-trans
2016-11-10Register and stability check `#[no_link]` crates.Jeffrey Seyfried-0/+2
2016-11-10Refactor `explicitly_linked: bool` -> `dep_kind: DepKind`.Jeffrey Seyfried-2/+3
2016-11-08Replace FnvHasher use with FxHasher.Nicholas Nethercote-4/+4
This speeds up compilation by 3--6% across most of rustc-benchmarks.
2016-10-06rustc: Rename rustc_macro to proc_macroAlex Crichton-3/+3
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.
2016-09-27add a panic-strategy field to the target specificationJorge Aparicio-2/+3
Now a target can define its panic strategy in its specification. If a user doesn't specify a panic strategy via the command line, i.e. '-C panic', then the compiler will use the panic strategy defined by the target specification. Custom targets can pick their panic strategy via the "panic-strategy" field of their target specification JSON file. If omitted in the specification, the strategy defaults to "unwind". closes #36647
2016-09-20rustc_metadata: go only through rustc_serialize in astencode.Eduard Burtescu-15/+15
2016-09-02rustc: Implement custom derive (macros 1.1)Alex Crichton-2/+7
This commit is an implementation of [RFC 1681] which adds support to the compiler for first-class user-define custom `#[derive]` modes with a far more stable API than plugins have today. [RFC 1681]: https://github.com/rust-lang/rfcs/blob/master/text/1681-macros-1.1.md The main features added by this commit are: * A new `rustc-macro` crate-type. This crate type represents one which will provide custom `derive` implementations and perhaps eventually flower into the implementation of macros 2.0 as well. * A new `rustc_macro` crate in the standard distribution. This crate will provide the runtime interface between macro crates and the compiler. The API here is particularly conservative right now but has quite a bit of room to expand into any manner of APIs required by macro authors. * The ability to load new derive modes through the `#[macro_use]` annotations on other crates. All support added here is gated behind the `rustc_macro` feature gate, both for the library support (the `rustc_macro` crate) as well as the language features. There are a few minor differences from the implementation outlined in the RFC, such as the `rustc_macro` crate being available as a dylib and all symbols are `dlsym`'d directly instead of having a shim compiled. These should only affect the implementation, however, not the public interface. This commit also ended up touching a lot of code related to `#[derive]`, making a few notable changes: * Recognized derive attributes are no longer desugared to `derive_Foo`. Wasn't sure how to keep this behavior and *not* expose it to custom derive. * Derive attributes no longer have access to unstable features by default, they have to opt in on a granular level. * The `derive(Copy,Clone)` optimization is now done through another "obscure attribute" which is just intended to ferry along in the compiler that such an optimization is possible. The `derive(PartialEq,Eq)` optimization was also updated to do something similar. --- One part of this PR which needs to be improved before stabilizing are the errors and exact interfaces here. The error messages are relatively poor quality and there are surprising spects of this such as `#[derive(PartialEq, Eq, MyTrait)]` not working by default. The custom attributes added by the compiler end up becoming unstable again when going through a custom impl. Hopefully though this is enough to start allowing experimentation on crates.io! syntax-[breaking-change]
2016-07-03prefer `if let` to match with `None => {}` arm in some placesZack M. Davis-9/+6
This is a spiritual succesor to #34268/8531d581, in which we replaced a number of matches of None to the unit value with `if let` conditionals where it was judged that this made for clearer/simpler code (as would be recommended by Manishearth/rust-clippy's `single_match` lint). The same rationale applies to matches of None to the empty block.
2016-05-19rustc: Add a new crate type, cdylibAlex Crichton-3/+4
This commit is an implementation of [RFC 1510] which adds a new crate type, `cdylib`, to the compiler. This new crate type differs from the existing `dylib` crate type in a few key ways: * No metadata is present in the final artifact * Symbol visibility rules are the same as executables, that is only reachable `extern` functions are visible symbols * LTO is allowed * All libraries are always linked statically This commit is relatively simple by just plubming the compiler with another crate type which takes different branches here and there. The only major change is an implementation of the `Linker::export_symbols` function on Unix which now actually does something. This helps restrict the public symbols from a cdylib on Unix. With this PR a "hello world" `cdylib` is 7.2K while the same `dylib` is 2.4MB, which is some nice size savings! [RFC 1510]: https://github.com/rust-lang/rfcs/pull/1510 Closes #33132
2016-05-09rustc: Implement custom panic runtimesAlex Crichton-38/+99
This commit is an implementation of [RFC 1513] which allows applications to alter the behavior of panics at compile time. A new compiler flag, `-C panic`, is added and accepts the values `unwind` or `panic`, with the default being `unwind`. This model affects how code is generated for the local crate, skipping generation of landing pads with `-C panic=abort`. [RFC 1513]: https://github.com/rust-lang/rfcs/blob/master/text/1513-less-unwinding.md Panic implementations are then provided by crates tagged with `#![panic_runtime]` and lazily required by crates with `#![needs_panic_runtime]`. The panic strategy (`-C panic` value) of the panic runtime must match the final product, and if the panic strategy is not `abort` then the entire DAG must have the same panic strategy. With the `-C panic=abort` strategy, users can expect a stable method to disable generation of landing pads, improving optimization in niche scenarios, decreasing compile time, and decreasing output binary size. With the `-C panic=unwind` strategy users can expect the existing ability to isolate failure in Rust code from the outside world. Organizationally, this commit dismantles the `sys_common::unwind` module in favor of some bits moving part of it to `libpanic_unwind` and the rest into the `panicking` module in libstd. The custom panic runtime support is pretty similar to the custom allocator support with the only major difference being how the panic runtime is injected (takes the `-C panic` flag into account).
2016-04-12Remove unused trait importsSeo Sanghyeon-1/+0
2015-12-30use structured errorsNick Cameron-4/+5
2015-11-26split the metadata code into rustc_metadataAriel Ben-Yehuda-2/+2
tests & rustdoc still broken
2015-11-26make CrateStore a trait objectAriel Ben-Yehuda-14/+17
rustdoc still broken
2015-11-26remove csearch from the rest of rustcAriel Ben-Yehuda-16/+15
2015-11-26stop using csearch in librustc and librustc_lintAriel Ben-Yehuda-11/+11
2015-08-14rustc: Allow changing the default allocatorAlex Crichton-34/+125
This commit is an implementation of [RFC 1183][rfc] which allows swapping out the default allocator on nightly Rust. No new stable surface area should be added as a part of this commit. [rfc]: https://github.com/rust-lang/rfcs/pull/1183 Two new attributes have been added to the compiler: * `#![needs_allocator]` - this is used by liballoc (and likely only liballoc) to indicate that it requires an allocator crate to be in scope. * `#![allocator]` - this is a indicator that the crate is an allocator which can satisfy the `needs_allocator` attribute above. The ABI of the allocator crate is defined to be a set of symbols that implement the standard Rust allocation/deallocation functions. The symbols are not currently checked for exhaustiveness or typechecked. There are also a number of restrictions on these crates: * An allocator crate cannot transitively depend on a crate that is flagged as needing an allocator (e.g. allocator crates can't depend on liballoc). * There can only be one explicitly linked allocator in a final image. * If no allocator is explicitly requested one will be injected on behalf of the compiler. Binaries and Rust dylibs will use jemalloc by default where available and staticlibs/other dylibs will use the system allocator by default. Two allocators are provided by the distribution by default, `alloc_system` and `alloc_jemalloc` which operate as advertised. Closes #27389