about summary refs log tree commit diff
path: root/src/librustc_interface
AgeCommit message (Collapse)AuthorLines
2020-05-06Rollup merge of #71269 - Mark-Simulacrum:sat-float-casts, r=nikicDylan DPC-1/+1
Define UB in float-to-int casts to saturate This closes #10184 by defining the behavior there to saturate infinities and values exceeding the integral range (on the lower or upper end). `NaN` is sent to zero.
2020-05-06Define UB in float-to-int casts to saturateMark Rousskov-1/+1
- Round to zero, and representable values cast directly. - `NaN` goes to 0 - Values beyond the limits of the type are saturated to the "nearest value" (essentially rounding to zero, in some sense) in the integral type, so e.g. `f32::INFINITY` would go to `{u,i}N::MAX.`
2020-05-05Rollup merge of #69984 - lenary:lenary/force-uwtables, r=hanna-kruppeDylan DPC-0/+1
Add Option to Force Unwind Tables When panic != unwind, `nounwind` is added to all functions for a target. This can cause issues when a panic happens with RUST_BACKTRACE=1, as there needs to be a way to reconstruct the backtrace. There are three possible sources of this information: forcing frame pointers (for which an option exists already), debug info (for which an option exists), or unwind tables. Especially for embedded devices, forcing frame pointers can have code size overheads (RISC-V sees ~10% overheads, ARM sees ~2-3% overheads). In production code, it can be the case that debug info is not kept, so it is useful to provide this third option, unwind tables, that users can use to reconstruct the call stack. Reconstructing this stack is harder than with frame pointers, but it is still possible. --- This came up in discussion on #69890, and turned out to be a fairly simple addition. r? @hanna-kruppe
2020-05-04Add Option to Force Unwind TablesSam Elliott-0/+1
When panic != unwind, `nounwind` is added to all functions for a target. This can cause issues when a panic happens with RUST_BACKTRACE=1, as there needs to be a way to reconstruct the backtrace. There are three possible sources of this information: forcing frame pointers (for which an option exists already), debug info (for which an option exists), or unwind tables. Especially for embedded devices, forcing frame pointers can have code size overheads (RISC-V sees ~10% overheads, ARM sees ~2-3% overheads). In code, it can be the case that debug info is not kept, so it is useful to provide this third option, unwind tables, that users can use to reconstruct the call stack. Reconstructing this stack is harder than with frame pointers, but it is still possible. This commit adds a compiler option which allows a user to force the addition of unwind tables. Unwind tables cannot be disabled on targets that require them for correctness, or when using `-C panic=unwind`.
2020-05-03Auto merge of #71631 - RalfJung:miri-unleash-the-gates, r=oli-obkbors-1/+1
Miri: unleash all feature gates IMO it is silly to unleash features that do not even have a feature gate yet, but not unleash features that do. The only thing this achieves is making unleashed mode annoying to use as we have to figure out the feature flags to enable (and not always do the error messages say what that flag is). Given that the point of `-Z unleash-the-miri-inside-of-you` is to debug the Miri internals, I see no good reason for this extra hurdle. I cannot imagine a situation where we'd use that flag, realize the program also requires some feature gate, and then be like "oh I guess if this feature is unstable I will do something else". Instead, we'll always just add that flag to the code as well, so requiring the flag achieves nothing. r? @oli-obk @ecstatic-morse Fixes https://github.com/rust-lang/rust/issues/71630
2020-05-02fix miri-unleash delayed sanity checkingRalf Jung-1/+1
2020-05-02cleanup: `config::CrateType` -> `CrateType`Vadim Petrochenkov-17/+16
2020-05-02Auto merge of #71716 - alexcrichton:bitcode-follow-up, r=nnethercotebors-2/+1
Rename `bitcode-in-rlib` option to `embed-bitcode` This commit finishes work first pioneered in #70458 and started in #71528. The `-C bitcode-in-rlib` option, which has not yet reached stable, is renamed to `-C embed-bitcode` since that more accurately reflects what it does now anyway. Various tests and such are updated along the way as well. This'll also need to be backported to the beta channel to ensure we don't accidentally stabilize `-Cbitcode-in-rlib` as well.
2020-05-01Remove leftover chalk typesJack Huey-4/+0
2020-05-01Rename `bitcode-in-rlib` option to `embed-bitcode`Alex Crichton-2/+1
This commit finishes work first pioneered in #70458 and started in #71528. The `-C bitcode-in-rlib` option, which has not yet reached stable, is renamed to `-C embed-bitcode` since that more accurately reflects what it does now anyway. Various tests and such are updated along the way as well. This'll also need to be backported to the beta channel to ensure we don't accidentally stabilize `-Cbitcode-in-rlib` as well.
2020-04-29Remove -Z no-landing-pads flagAmanieu d'Antras-1/+0
2020-04-28Auto merge of #71292 - marmeladema:queries-local-def-id, r=eddybbors-2/+2
Convert more queries to use `LocalDefId` This PR is based on commits in https://github.com/rust-lang/rust/pull/71215 and should partially solve #70853
2020-04-27Change return type of `entry_fn` query to return a `LocalDefId`marmeladema-1/+1
2020-04-27Accept `LocalDefId` as key for `mir_borrowck` querymarmeladema-1/+1
2020-04-27Rollup merge of #71558 - petrochenkov:tlsm, r=AmanieuDylan DPC-2/+3
Cleanup and document `-Z tls-model` r? @Amanieu
2020-04-26rustc_target: Stop using "string typing" for TLS modelsVadim Petrochenkov-2/+3
Introduce `enum TlsModel` instead.
2020-04-26Rollup merge of #71537 - Mark-Simulacrum:no-self-open, r=davidtwcoDylan DPC-1/+1
Remove support for self-opening This was only used for linkage test cases, which is already covered by the [run-make-fulldeps/symbol-visibility test](https://github.com/rust-lang/rust/blob/master/src/test/run-make-fulldeps/symbol-visibility/Makefile) -- which fairly extensively makes sure we're correctly exporting the right symbols at the right visibility (for various Rust crate types). This fixes #10379 and resolves #10356 by removing the test case (and underlying support in the compiler). AFAICT, the better way to test visibility is via nm, like the symbol visibility test. It seems like that's sufficient; I suspect that given that we don't use this we should just drop it (android is tier 2 anyway). But happy to hear otherwise.
2020-04-26Rollup merge of #71562 - matthiaskrgr:cl7ppy, r=Dylan-DPCDylan DPC-4/+4
fix more clippy warnings clippy::{redundant_pattern_matching, clone_on_copy, iter_cloned_collect, option_as_ref_deref, match_ref_pats} r? @Dylan-DPC
2020-04-26rustc_target: Stop using "string typing" for relocation modelsVadim Petrochenkov-2/+2
Introduce `enum RelocModel` instead.
2020-04-26fix more clippy warningsMatthias Krüger-4/+4
clippy::{redundant_pattern_matching, clone_on_copy, iter_cloned_collect, option_as_ref_deref, match_ref_pats}
2020-04-26Rollup merge of #71554 - gizmondo:68922, r=jonas-schievinkDylan DPC-3/+4
Replace thread_local with generator resume arguments in box_region. Fixes #68922. Continuation of #70622. Added a short doc, hope it makes sense. r? @jonas-schievink
2020-04-25Replace thread_local with generator resume arguments in box_region.Alex Aktsipetrov-3/+4
2020-04-25Remove support for self-openingMark Rousskov-1/+1
This was only used for linkage test cases, which is already covered by the run-make-fulldeps/symbol-visibility test -- which fairly extensively makes sure we're correctly exporting the right symbols at the right visibility (for various Rust crate types).
2020-04-24Replace filter_map().next() calls with find_map()Josh Stone-11/+8
These are semantically the same, but `find_map()` is more concise.
2020-04-23librustc_middle: return LocalDefId instead of DefId in local_def_idmarmeladema-1/+1
2020-04-22Use macros for option tests.Nicholas Nethercote-520/+177
2020-04-22Add all the missing option tests.Nicholas Nethercote-15/+273
2020-04-22Alphabetize the `-C` and `-Z` options.Nicholas Nethercote-77/+109
In the code, test, and docs, because it makes it much easier to find things. Other than adding the comments about alphabetical order, this commit only moves things around.
2020-04-22Auto merge of #71323 - nnethercote:bitcode-in-rlib, r=alexcrichtonbors-0/+4
Add `-Cbitcode-in-rlib`. This is a cut-down version of #70458 that gets the compile-time wins. r? @alexcrichton
2020-04-22Add a new option `-Cbitcode-in-rlib`.Nicholas Nethercote-0/+4
It defaults to true, but Cargo will set this to false whenever it can to reduce compile times.
2020-04-22Rollup merge of #71236 - sinkuu:cleanup, r=nikomatsakisYuki Okushi-1/+0
Remove unused rustc_serialize::hex module * Remove unused `rustc_serialize::hex` module * Cleanup `Cargo.toml`
2020-04-20Remove unused dependenciesShotaro Yamada-1/+0
2020-04-19Replace uses of `parse_opt_*` with `parse_*` where possible.Nicholas Nethercote-3/+3
This lets us specify the default at the options declaration point, instead of using `.unwrap(default)` or `None | Some(default)` at some use point far away. It also makes the code more concise.
2020-04-11Depend on getopts from crates.ioLuca Barbieri-2/+1
rustc_session exports it for other crates to avoid mismatching crate versions.
2020-04-11Depend on libc from crates.ioLuca Barbieri-3/+1
2020-04-10librustc_middle: return LocalDefId instead of DefId in body_owner_def_idmarmeladema-3/+3
2020-04-06Rollup merge of #70665 - petrochenkov:linkargs, r=nagisaMazdak Farrokhzad-1/+1
Do not lose or reorder user-provided linker arguments Linker arguments are potentially order-dependent, so the order in which `-C link-arg` and `-C link-args` options are passed to `rustc` should be preserved when they are passed further to the linker. Also, multiple `-C link-args` options are now appended to each other rather than overwrite each other. In other words, `-C link-arg=a -C link-args="b c" -C link-args="d e" -C link-arg=f` is now passed as `"a" "b" "c" "d" "e" "f"` and not as `"d" "e" "a" "f"`. Addresses https://github.com/rust-lang/rust/pull/70505#issuecomment-606780163.
2020-04-05Query-ify Instance::resolveAaron Hill-1/+0
2020-04-04Do not lose or reorder user-provided linker argumentsVadim Petrochenkov-1/+1
2020-04-02Add hash of source files in debug infoArlo Siemsen-5/+3
* Adds either an MD5 or SHA1 hash to the debug info. * Adds new unstable option `-Z src-hash-algorithm` to control the hashing algorithm.
2020-04-02use direct import for ErrorReportedMazdak Farrokhzad-4/+3
2020-04-01Rollup merge of #70511 - ecstatic-morse:mir-dataflow-graphviz, r=davidtwcoMazdak Farrokhzad-0/+2
Add `-Z dump-mir-dataflow` flag for dumping dataflow results visualization Previously, to visualize the results of a MIR dataflow pass, one had to add a `#[rustc_mir(borrowck_graphviz_postflow)]` attribute to functions of interest. However, there is no way to specify this attribute on closures and generators, so it was impossible to view results for these MIR bodies. This PR adds a flag, `-Z dump-mir-dataflow`, which will output the dataflow results for any functions specified in `-Z dump-mir` to the output directory specified by `-Z dump-mir-dir`. This behavior is modeled on the `-Z dump-mir-graphviz` flag.
2020-03-31more clippy fixesMatthias Krüger-1/+1
use is_empty() instead of len comparison (clippy::len_zero) use if let instead of while let loop that never loops (clippy::never_loop) remove redundant returns (clippy::needless_return) remove redundant closures (clippy::redundant_closure) use if let instead of match and wildcard pattern (clippy::single_match) don't repeat field names redundantly (clippy::redundant_field_names)
2020-03-30rustc -> rustc_middle part 3 (rustfmt)Mazdak Farrokhzad-11/+11
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-21/+21
2020-03-30rustc -> rustc_middle part 1Mazdak Farrokhzad-5/+5
2020-03-28Add `-Z dump-mir-dataflow`Dylan MacKenzie-0/+2
2020-03-28Auto merge of #70261 - Centril:angle-args-partition, r=varkorbors-7/+9
Move arg/constraint partition check to validation & improve recovery - In the first commit, we move the check rejecting e.g., `<'a, Item = u8, String>` from the parser into AST validation. - We then use this to improve the code for parsing generic arguments. - And we add recovery for e.g., `<Item = >` (missing), `<Item = 42>` (constant), and `<Item = 'a>` (lifetime). This is also preparatory work for supporting https://github.com/rust-lang/rust/issues/70256. r? @varkor
2020-03-27parse: move constraint/arg restriction to ast_validation.Mazdak Farrokhzad-7/+9
2020-03-27Remove `no_integrated_as` mode.Nicholas Nethercote-4/+0
Specifically, remove both `-Z no_integrated_as` and `TargetOptions::no_integrated_as`. The latter was only used for the `msp430_none_elf` platform, for which it's no longer required.