about summary refs log tree commit diff
path: root/src/librustc_session
AgeCommit message (Collapse)AuthorLines
2020-05-06Rollup merge of #71269 - Mark-Simulacrum:sat-float-casts, r=nikicDylan DPC-2/+2
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-2/+2
- 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/+46
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/+46
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/+47
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-03fmtRalf Jung-1/+1
2020-05-03warn about each skipped feature gateRalf Jung-21/+27
2020-05-03Rollup merge of #71542 - crlf0710:confusable_idents, r=petrochenkovDylan DPC-0/+16
Implement `confusable_idents` lint. This collects all identifier symbols into `ParseSession` and examines them within the non-ascii-idents lint. The skeleton generation part needs to be added to `unicode-security` crate. Will update this PR when the crate is updated. r? @petrochenkov EDIT: also included the `concat_idents` part.
2020-05-03Implement `confusable_idents` lint.Charles Lew-0/+16
2020-05-02fix miri-unleash delayed sanity checkingRalf Jung-9/+14
2020-05-02make sure the miri-unleash-flag is not used to circumvent feature gatesRalf Jung-1/+36
2020-05-02cleanup: `config::CrateType` -> `CrateType`Vadim Petrochenkov-20/+20
2020-05-01Rename `bitcode-in-rlib` option to `embed-bitcode`Alex Crichton-6/+4
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 Session::no_landing_pads()Amanieu d'Antras-3/+0
2020-04-29Remove -Z no-landing-pads flagAmanieu d'Antras-3/+1
2020-04-26rustc_target: Stop using "string typing" for TLS modelsVadim Petrochenkov-8/+21
Introduce `enum TlsModel` instead.
2020-04-26rustc-book: Document `-C relocation-model`Vadim Petrochenkov-1/+2
2020-04-26rustc_target: Stop using "string typing" for relocation modelsVadim Petrochenkov-12/+21
Introduce `enum RelocModel` instead.
2020-04-23Rollup merge of #71408 - GuillaumeGomez:check-code-blocks-tags, r=kinnisonDylan DPC-0/+7
Check code blocks tags Fixes #71347. Explanations here: I realized recently that it was a common issue to confuse/misspell tags on code blocks. This is actually quite a big issue since it generally ends up in a code blocks being ignored since it's not being considered as a rust one. With this new warning, users will at least be notified about it. PS: some improvements can be done on the error rendering but considering how big the PR already is, I think it's better to do it afterwards. r? @ollie27 cc @rust-lang/rustdoc
2020-04-23Create new rustdoc lint to check for code blocks tagsGuillaume Gomez-0/+7
2020-04-22Alphabetize the `-C` and `-Z` options.Nicholas Nethercote-270/+294
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-22Add a new option `-Cbitcode-in-rlib`.Nicholas Nethercote-0/+12
It defaults to true, but Cargo will set this to false whenever it can to reduce compile times.
2020-04-20Auto merge of #70729 - nnethercote:a-big-options-clean-up, r=petrochenkovbors-248/+232
A big options clean-up Lots of improvements here. r? @Centril
2020-04-19Dogfood more or_patterns in the compilerJosh Stone-4/+3
2020-04-19Disallow values for `-C no-*` and `-Z no-*` options again.Nicholas Nethercote-24/+34
With the exception of `-C no-redzone`, because that could take a value before this PR. This partially undoes one of the earlier commits in this PR, which added the ability to take a value to all boolean options that lacked it. The help output for these options looks like this: ``` -C no-vectorize-slp=val -- disable LLVM's SLP vectorization pass ``` The "=val" part is a lie, but hopefully this will be fixed in the future.
2020-04-19Show defaults in options descriptions.Nicholas Nethercote-99/+109
For all `-C` and `-Z` options that have them. The commit also rewords a few options to make them clearer, mostly by avoiding the word "don't". It also removes the listed default for `-Cinline-threshold`, which is incorrect -- that option doesn't have a static default.
2020-04-19Replace uses of `parse_opt_*` with `parse_*` where possible.Nicholas Nethercote-39/+37
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-19Make option type descriptions non-optional.Nicholas Nethercote-59/+38
Because all options now can take a value. This simplifies some code quite a bit.
2020-04-19Tweak `parse_opt_uint`.Nicholas Nethercote-1/+1
Don't set `slot` on failure, like all the other `parse_*` functions.
2020-04-19Fix the `-Zsanitizer_memory_track_origins` error message.Nicholas Nethercote-13/+7
Currently, if you give a bogus value like `-Zsanitizer-memory-track-origins=99` you get this incorrect error: ``` error: debugging option `sanitizer-memory-track-origins` takes no value ``` This commit fixes it so it gives this instead: ``` error: incorrect value `99` for debugging option `sanitizer-memory-track-origins` - 0, 1, or 2 was expected ``` The commit also makes `parse_sanitizer_memory_track_origins` more readable.
2020-04-19Clean up the list of parser descriptions.Nicholas Nethercote-7/+6
Put identical ones next to each other, and avoid duplicated strings.
2020-04-19Allow all boolean options to take values.Nicholas Nethercote-28/+22
They now all accept yes/no/y/n/on/off values. (Previously only some of them did.) This commit also makes `parse_bool` and `parse_opt_bool` more concise and readable, and adds some helpful comments to some functions.
2020-04-19Make some option descriptions fit the usual pattern.Nicholas Nethercote-6/+6
- No trailing '.' chars. - Use a lower-case letter at the start.
2020-04-18Add an option to inhibit automatic injection of profiler_builtinsAmanieu d'Antras-0/+2
2020-04-17Make -Zprofile set codegen-units to 1Amanieu d'Antras-1/+11
2020-04-11Depend on getopts from crates.ioLuca Barbieri-6/+3
rustc_session exports it for other crates to avoid mismatching crate versions.
2020-04-09mark a temporary hack as suchRalf Jung-1/+3
2020-04-07rustc_session: forbid lints override regardless of positionTobias Thiel-1/+7
2020-04-07Speed up path searching with `find_library_crate`.Nicholas Nethercote-13/+39
By doing prefix and suffix checking on a `String` copy of each relevant `PathBuf`, rather than the `PathBuf` itself.
2020-04-04Do not lose or reorder user-provided linker argumentsVadim Petrochenkov-5/+13
2020-04-04Auto merge of #69718 - arlosi:debughash, r=eddybbors-38/+63
Add hash of source files in debug info LLVM supports placing the hash of source files inside the debug info. This information can be used by a debugger to verify that the source code matches the executable. This change adds support for both hash algorithms supported by LLVM, MD5 and SHA1, controlled by a target option. * DWARF only supports MD5 * LLVM IR supports MD5 and SHA1 (and SHA256 in LLVM 11). * CodeView (.PDB) supports MD5, SHA1, and SHA256. Fixes #68980. Tracking issue: #70401 rustc dev guide PR with further details: https://github.com/rust-lang/rustc-dev-guide/pull/623
2020-04-03Auto merge of #70156 - michaelwoerister:incr-cgus, r=nikomatsakisbors-0/+7
Make the rustc respect the `-C codegen-units` flag in incremental mode. This PR implements (the as of yet unapproved) major change proposal at https://github.com/rust-lang/compiler-team/issues/245. See the description there for background and rationale. The changes are pretty straightforward and should be easy to rebase if the proposal gets accepted at some point. r? @nikomatsakis cc @pnkfelix
2020-04-03Minor follow-up after renaming librustc(_middle)Yuki Okushi-4/+5
2020-04-02Add hash of source files in debug infoArlo Siemsen-38/+63
* 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-02Translate the virtual `/rustc/$hash` prefix back to a real directory.Eduard-Mihai Burtescu-0/+30
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-31Make the rustc respect the `-C codegen-units` flag in incremental mode.Michael Woerister-0/+7
Before this commit `-C codegen-units` would just get silently be ignored if `-C incremental` was specified too. After this commit one can control the number of codegen units generated during incremental compilation. The default is rather high at 256, so most crates won't see a difference unless explicitly opting into a lower count.
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 2Mazdak Farrokhzad-1/+1
2020-03-30rustc -> rustc_middle part 1Mazdak Farrokhzad-2/+2