about summary refs log tree commit diff
path: root/src/librustc_session
AgeCommit message (Collapse)AuthorLines
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
2020-03-29Auto merge of #70370 - petrochenkov:nosmatch, r=Centrilbors-1/+1
Remove attribute `#[structural_match]` and any references to it A small remaining part of https://github.com/rust-lang/rust/issues/63438.
2020-03-28Add `-Z dump-mir-dataflow`Dylan MacKenzie-0/+2
2020-03-28Auto merge of #66938 - GuillaumeGomez:lint-for-no-crate-level-doc, r=Dylan-DPCbors-0/+7
Add lint when no doc is present at the crate-level Follow-up of #66267. r? @kinnison
2020-03-28Auto merge of #70095 - jsgf:link-native, r=nagisabors-0/+2
Implement -Zlink-native-libraries This implements a flag `-Zlink-native-libraries=yes/no`. If set to true/yes, or unspecified, then native libraries referenced via `#[link]` attributes will be put on the linker line (ie, unchanged behaviour). If `-Zlink-native-libraries=no` is specified then rustc will not add the native libraries to the link line. The assumption is that the outer build system driving the build already knows about the native libraries and will specify them to the linker directly (for example via `-Clink-arg=`). Addresses issue #70093
2020-03-27Implement -Zlink-native-librariesJeremy Fitzhardinge-0/+2
This implements a flag `-Zlink-native-libraries=yes/no`. If set to true/yes, or unspecified, then native libraries referenced via `#[link]` attributes will be put on the linker line (ie, unchanged behaviour). If `-Zlink-native-libraries=no` is specified then rustc will not add the native libraries to the link line. The assumption is that the outer build system driving the build already knows about the native libraries and will specify them to the linker directly (for example via `-Clink-arg=`). Addresses issue #70093
2020-03-27Remove `no_integrated_as` mode.Nicholas Nethercote-2/+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.
2020-03-25Rollup merge of #70319 - lcnr:issue63695, r=eddybDylan DPC-4/+4
correctly normalize constants closes #70317 implements https://github.com/rust-lang/rust/issues/70125#issuecomment-602133708 r? eddyb cc @varkor
2020-03-24Remove attribute `#[structural_match]` and any references to itVadim Petrochenkov-1/+1
2020-03-24Remove `-Z incremental`.Nicholas Nethercote-30/+1
`-C incremental` was introduced over two years ago. `-Z incremental` was kept for transitioning, but it's been long enough now that it should be ok to remove it.
2020-03-24Remove several dead `-Z` options.Nicholas Nethercote-8/+0
2020-03-24Invert `-Z generate-arange-section`.Nicholas Nethercote-2/+2
Because it uses `parse_bool` and defaults to true, it is actually impossible to set it to false. Inverting its sense to `-Z no-generate-arange-section` makes it usable.
2020-03-24Remove `-Z incremental-queries`.Nicholas Nethercote-2/+0
Because it uses `parse_bool` and defaults to true, it is actually impossible to set it to false. And it hasn't been experimental for some time now.
2020-03-24Add a comment to `parse_bool`.Nicholas Nethercote-0/+3
It's behaviour can be surprising.
2020-03-23query normalize_generic_arg_after_erasing_regionsBastian Kauschke-4/+4
2020-03-23Auto merge of #70296 - Centril:rollup-wvfmb3n, r=Centrilbors-1/+1
Rollup of 9 pull requests Successful merges: - #69251 (#[track_caller] in traits) - #69880 (miri engine: turn error sanity checks into assertions) - #70207 (Use getentropy(2) on macos) - #70227 (Only display definition when suggesting a typo) - #70236 (resolve: Avoid "self-confirming" import resolutions in one more case) - #70248 (parser: simplify & remove unused field) - #70249 (handle ConstKind::Unresolved after monomorphizing) - #70269 (remove redundant closures (clippy::redundant_closure)) - #70270 (Clean up E0449 explanation) Failed merges: r? @ghost
2020-03-22Update lint name to follow conventionGuillaume Gomez-2/+2
2020-03-22rename NO_CRATE_LEVEL_DOC lint into MISSING_CRATE_LEVEL_DOCGuillaume Gomez-2/+2
2020-03-22Add lint when no doc is present at the crate-levelGuillaume Gomez-0/+7
2020-03-22remove redundant closures (clippy::redundant_closure)Matthias Krüger-1/+1
2020-03-21move CrateDisambiguator -> rustc_astMazdak Farrokhzad-49/+10
2020-03-21add_elided_lifetime_in_path_suggestion -> rustc_sessionMazdak Farrokhzad-0/+43
2020-03-21Rollup merge of #69965 - mark-i-m:codegen-utils, r=eddybMazdak Farrokhzad-0/+224
Refactorings to get rid of rustc_codegen_utils r? @eddyb cc #45276 After this, the only modules left in `rustc_codegen_utils` are - `link`: a bunch of linking-related functions (many dealing with file names). These are mostly consumed by save analysis, rustc_driver, rustc_interface, and of course codegen. I assume they live here because we don't want a dependency of save analysis on codegen... Perhaps they can be moved to librustc? - ~`symbol_names` and `symbol_names_test`: honestly it seems odd that `symbol_names_test` is not a submodule of `symbol_names`. It seems like these could honestly live in their own crate or move to librustc. Already name mangling is exported as the `symbol_name` query.~ (move it to its own crate) I don't mind doing either of the above as part of this PR or a followup if you want.
2020-03-20remove redundant returns (clippy::needless_return)Matthias Krüger-1/+1