summary refs log tree commit diff
path: root/src/librustc/session
AgeCommit message (Collapse)AuthorLines
2017-04-14add 'mir' as part of the --emit flag list in rustc --help menu and man doc.nate-1/+1
This is added because 'rustc' can now generate MIR (referencing to "Teach rustc --emit=mir #39891").
2017-04-13remove `LinkMeta` from `SharedCrateContext`Niko Matsakis-7/+5
A number of things were using `crate_hash` that really ought to be using `crate_disambiguator` (e.g., to create the plugin symbol names). They have been updated. It is important to remove `LinkMeta` from `SharedCrateContext` since it contains a hash of the entire crate, and hence it will change whenever **anything** changes (which would then require rebuilding **everything**).
2017-04-11Fix some nitsSimonas Kazlauskas-3/+2
2017-04-11Make a comment better.Austin Hicks-1/+1
2017-04-11Initial attempt at implementing optimization fuel and re-enabling struct ↵Austin Hicks-1/+1
field reordering.
2017-04-11Tests for -Z fuel=foo=nAustin Hicks-1/+1
2017-04-11Make a comment better.Austin Hicks-1/+1
2017-04-11Initial attempt at implementing optimization fuel and re-enabling struct ↵Austin Hicks-0/+76
field reordering.
2017-04-07-Z linker-flavorJorge Aparicio-3/+18
This patch adds a `-Z linker-flavor` flag to rustc which can be used to invoke the linker using a different interface. For example, by default rustc assumes that all the Linux targets will be linked using GCC. This makes it impossible to use LLD as a linker using just `-C linker=ld.lld` because that will invoke LLD with invalid command line arguments. (e.g. rustc will pass -Wl,--gc-sections to LLD but LLD doesn't understand that; --gc-sections would be the right argument) With this patch one can pass `-Z linker-flavor=ld` to rustc to invoke the linker using a LD-like interface. This way, `rustc -C linker=ld.lld -Z linker-flavor=ld` will invoke LLD with the right arguments. `-Z linker-flavor` accepts 4 different arguments: `em` (emcc), `ld`, `gcc`, `msvc` (link.exe). `em`, `gnu` and `msvc` cover all the existing linker interfaces. `ld` is a new flavor for interfacing GNU's ld and LLD. This patch also changes target specifications. `linker-flavor` is now a mandatory field that specifies the *default* linker flavor that the target will use. This change also makes the linker interface *explicit*; before, it used to be derived from other fields like linker-is-gnu, is-like-msvc, is-like-emscripten, etc. Another change to target specifications is that the fields `pre-link-args`, `post-link-args` and `late-link-args` now expect a map from flavor to linker arguments. ``` diff - "pre-link-args": ["-Wl,--as-needed", "-Wl,-z,-noexecstack"], + "pre-link-args": { + "gcc": ["-Wl,--as-needed", "-Wl,-z,-noexecstack"], + "ld": ["--as-needed", "-z,-noexecstack"], + }, ``` [breaking-change] for users of custom targets specifications
2017-03-21Teach rustc --emit=mirJake Goulding-0/+6
2017-03-17Rollup merge of #40463 - tshepang:nit, r=nikomatsakisCorey Farwell-1/+4
some style fixes
2017-03-13some style fixesTshepang Lekhonkhobe-1/+4
2017-03-12Update usages of 'OSX' (and other old names) to 'macOS'.Corey Farwell-1/+1
As of last year with version 'Sierra', the Mac operating system is now called 'macOS'.
2017-02-25rustc: introduce a query system for type information in ty::maps.Eduard Burtescu-4/+4
2017-02-25Rollup merge of #40037 - froydnj:overflow-checks, r=alexcrichtonEduard-Mihai Burtescu-0/+11
add `-C overflow-checks` option In addition to defining and handling the new option, we also add a method on librustc::Session for determining the necessity of overflow checks. This method provides a single point to sort out the three (!) different ways for turning on overflow checks: -C debug-assertions, -C overflow-checks, and -Z force-overflow-checks. I was seeing a [run-pass/issue-28950.rs](https://github.com/rust-lang/rust/blob/b1363a73ede57ae595f3a1be2bb75d308ba4f7f6/src/test/run-pass/issue-28950.rs) failure on my machine with these patches, but I was also seeing the failure without the changes to the core compiler. We'll see what travis says. Fixes #33134. r? @alexcrichton
2017-02-25Rollup merge of #40022 - wagenet:lib-defaults, r=alexcrichtonEduard-Mihai Burtescu-29/+30
Better handling of lib defaults r? @alexcrichton
2017-02-23Better handling of lib defaultsPeter Wagenet-29/+30
2017-02-22add `-C overflow-checks` optionNathan Froyd-0/+11
In addition to defining and handling the new option, we also add a method on librustc::Session for determining the necessity of overflow checks. This method provides a single point to sort out the three (!) different ways for turning on overflow checks: -C debug-assertions, -C overflow-checks, and -Z force-overflow-checks. Fixes #33134.
2017-02-20incr-comp: track the -Z sanitizer flagJorge Aparicio-3/+5
closes #39611
2017-02-08sanitizer supportJorge Aparicio-1/+24
2017-02-04Auto merge of #38426 - vadimcn:nobundle, r=alexcrichtonbors-0/+5
Implement kind="static-nobundle" (RFC 1717) This implements the "static-nobundle" library kind (last item from #37403). Rustc handles "static-nobundle" libs very similarly to dylibs, except that on Windows, uses of their symbols do not get marked with "dllimport". Which is the whole point of this feature.
2017-02-02introduce `LintTable`Niko Matsakis-14/+7
2017-01-24incr.comp.: Make cross-crate tracking for incr. comp. opt-in.Michael Woerister-0/+2
2017-01-19Feature gateVadim Chugunov-0/+4
2017-01-19Implement the "static-nobundle" library kind (RFC 1717).Vadim Chugunov-0/+1
These are static libraries that are not bundled (as the name implies) into rlibs and staticlibs that rustc generates, and must be present when the final binary artifact is being linked.
2017-01-17Refactor the parser to consume token trees.Jeffrey Seyfried-1/+2
2017-01-10Rollup merge of #38841 - F001:Fix, r=steveklabnikSeo Sanghyeon-1/+1
Update usage of rustc Add proc_macro crate type
2017-01-05Update usage of rustcF001-1/+1
Add proc_macro crate type
2017-01-03fix help for the --print optionDoug Goldstein-1/+2
Since 8285ab5c99, which was merged in with #38061, the help for the --print option is missing the surrounding [ ] around the possible options. Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
2016-12-29Support --emit=foo,metadataNick Cameron-0/+13
2016-12-29Restore --crate-type=metadata as an alias for ↵Nick Cameron-4/+15
--crate-type=rlib,--emit=metadata + a warning
2016-12-29Change --crate-type metadata to --emit=metadataNick Cameron-6/+8
2016-12-24Add a min_atomic_width target option, like max_atomic_width.whitequark-1/+2
Rationale: some ISAs, e.g. OR1K, do not have atomic instructions for byte and halfword access, and at the same time do not have a fixed endianness, which makes it unreasonable to implement these through word-sized atomic accesses.
2016-12-23Auto merge of #38401 - redox-os:redox_cross, r=brsonbors-12/+6
Redox Cross Compilation I will admit - there are things here that I wish I did not have to do. This completes the ability to create a cross compiler from the rust repository for `x86_64-unknown-redox`. I will document this PR with inline comments explaining some things. [View this gist to see how a cross compiler is built](https://gist.github.com/jackpot51/6680ad973986e84d69c79854249f2b7e) Prior discussion of a smaller change is here: https://github.com/rust-lang/rust/pull/38366
2016-12-22Convert fam to SymbolJeremy Soller-3/+3
2016-12-22Correct target_family messJeremy Soller-12/+6
2016-12-20Rollup merge of #38418 - michaelwoerister:def_path_cleanup, r=eddybAlex Crichton-0/+5
Cleanup refactoring around DefPath handling This PR makes two big changes: * All DefPaths of a crate are now stored in metadata in their own table (as opposed to `DefKey`s as part of metadata `Entry`s. * The compiler will no longer allocate a pseudo-local DefId for inlined HIR nodes (because those are gross). Inlined HIR nodes will have a NodeId but they don't have there own DefId anymore. Turns out they were not needed anymore either. Hopefully HIR inlining will be gone completely one day but if until then we start needing to be able to map inlined NodeIds to original DefIds, we can add an additional table to metadata that allows for reconstructing this. Overall this makes for some nice simplifications and removal of special cases. r? @eddyb cc @rust-lang/compiler
2016-12-18Auto merge of #37429 - camlorn:univariant_layout_optimization, r=eddybbors-1/+6
struct field reordering and optimization This is work in progress. The goal is to divorce the order of fields in source code from the order of fields in the LLVM IR, then optimize structs (and tuples/enum variants)by always ordering fields from least to most aligned. It does not work yet. I intend to check compiler memory usage as a benchmark, and a crater run will probably be required. I don't know enough of the compiler to complete this work unaided. If you see places that still need updating, please mention them. The only one I know of currently is debuginfo, which I'm putting off intentionally until a bit later. r? @eddyb
2016-12-17rustbuild: Fix LC_ID_DYLIB directives on OSXAlex Crichton-0/+2
Currently libraries installed by rustbuild on OSX have an incorrect `LC_ID_DYLIB` directive located in the dynamic libraries that are installed. The directive we expect looks like: @rpath/libstd.dylib Which means that if you want to find that dynamic library you should look at the dylib's other `@rpath` directives. Typically our `@rpath` directives look like `@loader_path/../lib` for the compiler as that's where the installed libraries will be located. Currently, though, rustbuild produces dylibs with the directive that looks like: /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/build/x86_64-apple-darwin/stage1-std/x86_64-apple-darwin/release/deps/libstd-713ad88203512705.dylib In other words, the build directory is encoded erroneously. The compiler already [knows how] to change this directive, but it only passes that argument when `-C rpath` is also passed. The rustbuild system, however, explicitly [does not pass] this option explicitly and instead bakes its own. This logic then also erroneously didn't pass `-Wl,-install_name` like the compiler. [knows how]: https://github.com/rust-lang/rust/blob/4a008cccaabc8b3fe65ccf5868b9d16319c9ac58/src/librustc_trans/back/linker.rs#L210-L214 [does not pass]: https://github.com/rust-lang/rust/blob/4a008cccaabc8b3fe65ccf5868b9d16319c9ac58/src/bootstrap/bin/rustc.rs#L133-L158 To fix this regression this patch introduces a new `-Z` flag, `-Z osx-rpath-install-name` which basically just forces the compiler to take the previous `-install_name` branch when creating a dynamic library. Hopefully we can sort out a better rpath story in the future, but for now this "hack" should suffice in getting our nightly builds back to the same state as before. Closes #38430
2016-12-16definitions: Add some timing stats for DefPathTable decoding.Michael Woerister-0/+5
2016-12-14Fix -Z print-type-sizes and tests.Austin Hicks-1/+6
This was done by sorting the fields by increasing offset; as a consequence, the order of -Z print-type-sizes matches memory order not source order.
2016-12-11Simplify use of mir_opt_levelUlrik Sverdrup-8/+3
Remove the unused top level option by the same name, and retain the debug option. Use -Zmir-opt-level=1 as default. One pass is enabled by default but wants to be optional: - Instcombine requires mir_opt_level > 0 Copy propagation is not used by default, but used to be activated by explicit -Zmir-opt-level=1. It must move one higher to be off by default: - CopyPropagation requires mir_opt_level > 1 Deaggregate is not used by default, and used to be on a different level than CopyPropagation: - Deaggreate requires mir_opt_level > 2
2016-12-07add a -Z flag to guarantee that MIR is generated for all functionsOliver Schneider-0/+2
2016-12-06Auto merge of #37973 - vadimcn:dllimport, r=alexcrichtonbors-22/+50
Implement RFC 1717 Implement the first two points from #37403. r? @alexcrichton
2016-12-04Auto merge of #38092 - pnkfelix:mir-stats, r=nikomatsakisbors-0/+2
Adds `-Z mir-stats`, which is similar to `-Z hir-stats`. Adds `-Z mir-stats`, which is similar to `-Z hir-stats`. Some notes: * This code attempts to present the breakdown of each variant for every enum in the MIR. This is meant to guide decisions about how to revise representations e.g. when to box payloads for rare variants to shrink the size of the enum overall. * I left out the "Total:" line that hir-stats presents, because this implementation uses the MIR Visitor infrastructure, and the memory usage of structures directly embedded in other structures (e.g. the `func: Operand` in a `TerminatorKind:Call`) is not distinguished from similar structures allocated in a `Vec` (e.g. the `args: Vec<Operand>` in a `TerminatorKind::Call`). This means that a naive summation of all the accumulated sizes is misleading, because it will double-count the contribution of the `Operand` of the `func` as well as the size of the whole `TerminatorKind`. * I did consider abandoning the MIR Visitor and instead hand-coding a traversal that distinguished embedded storage from indirect storage. But such code would be fragile; better to just require people to take care when interpreting the presented results. * This traverses the `mir.promoted` rvalues to capture stats for MIR stored there, even though the MIR visitor super_mir method does not do so. (I did not observe any promoted mir being newly traversed when compiling the rustc crate, however.) * It might be nice to try to unify this code with hir-stats. Then again, the reporting portion is the only common code (I think), and it is small compared to the visitors in hir-stats and mir-stats.
2016-12-03Rollup merge of #38113 - nikomatsakis:incremental-dump-hash, r=michaelwoeristerCorey Farwell-0/+2
add a `-Z incremental-dump-hash` flag This causes us to dump a bunch of has information to stdout that can be useful in tracking down incremental compilation invalidations, particularly across crates.
2016-12-03Auto merge of #38061 - cardoe:target-spec, r=alexcrichtonbors-3/+11
print option to dump target spec as JSON This lets the user dump out the target spec that the compiler is using. This is useful to people defining their own target.json to compare it against existing targets or understand how different targets change internal settings. It is also potentially useful for Cargo to determine if something has changed with a target and it needs to rebuild things.
2016-12-02rustc: add --print target-spec optionDoug Goldstein-0/+6
This option provides the user the ability to dump the configuration that is in use by rustc for the target they are building for. Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
2016-12-01Implement native library kind and name overrides from the command line.Vadim Chugunov-22/+50
2016-12-01convert --print options to a vectorDoug Goldstein-3/+5
To allow manipulation of the options that appear in --print, convert it to a vector. Signed-off-by: Doug Goldstein <cardoe@cardoe.com>