summary refs log tree commit diff
path: root/compiler/rustc_session/src/config.rs
AgeCommit message (Collapse)AuthorLines
2022-09-08translations(rustc_session): remove lint allow rule to the methods marked ↵Luis Cardoso-2/+1
with rustc_lint_diagnostic This commit removes the allows rules for the SessionDiagnostic lint that were being used in the session.rs file. Thanks to the PR #101230 we do not need to annotate the methods with the allow rule as they are part of the diagnostic machinery.
2022-09-08translations(rustc_session): migrates session.rs and config.rsLuis Cardoso-1/+2
2022-09-03Auto merge of #100574 - Urgau:check-cfg-warn-cfg, r=petrochenkovbors-1/+1
Add warning against unexpected --cfg with --check-cfg This PR adds a warning when an unexpected `--cfg` is specified but not in the specified list of `--check-cfg`. This is the follow-up PR I mentioned in https://github.com/rust-lang/rust/pull/99519. r? `@petrochenkov`
2022-09-02Auto merge of #97802 - Enselic:add-no_ignore_sigkill-feature, r=joshtriplettbors-1/+11
Support `#[unix_sigpipe = "inherit|sig_dfl"]` on `fn main()` to prevent ignoring `SIGPIPE` When enabled, programs don't have to explicitly handle `ErrorKind::BrokenPipe` any longer. Currently, the program ```rust fn main() { loop { println!("hello world"); } } ``` will print an error if used with a short-lived pipe, e.g. % ./main | head -n 1 hello world thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', library/std/src/io/stdio.rs:1016:9 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace by enabling `#[unix_sigpipe = "sig_dfl"]` like this ```rust #![feature(unix_sigpipe)] #[unix_sigpipe = "sig_dfl"] fn main() { loop { println!("hello world"); } } ``` there is no error, because `SIGPIPE` will not be ignored and thus the program will be killed appropriately: % ./main | head -n 1 hello world The current libstd behaviour of ignoring `SIGPIPE` before `fn main()` can be explicitly requested by using `#[unix_sigpipe = "sig_ign"]`. With `#[unix_sigpipe = "inherit"]`, no change at all is made to `SIGPIPE`, which typically means the behaviour will be the same as `#[unix_sigpipe = "sig_dfl"]`. See https://github.com/rust-lang/rust/issues/62569 and referenced issues for discussions regarding the `SIGPIPE` problem itself See the [this](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Proposal.3A.20First.20step.20towards.20solving.20the.20SIGPIPE.20problem) Zulip topic for more discussions, including about this PR. Tracking issue: https://github.com/rust-lang/rust/issues/97889
2022-09-02Make CrateConfig make order depended for linting purposeUrgau-1/+1
2022-09-02Rollup merge of #100552 - petrochenkov:flavorcompat, r=lqdGuillaume Gomez-12/+2
rustc_target: Add a compatibility layer to separate internal and user-facing linker flavors I want to do some refactorings in `rustc_target` - merge `lld_flavor` and `linker_is_gnu` into `linker_flavor`, support combination gcc+lld (https://github.com/rust-lang/rust/pull/96827). This PR adds some compatibility infra that makes that possible without making any changes to user-facing interfaces - `-Clinker-flavor` values and json target specs. (For json target specs this infra may eventually go away since they are not very stable.) The second commit does some light refactoring of internal linker flavors (applies changes from https://github.com/petrochenkov/rust/commit/53eca42973b7e379b9fa0469c33f08680b57c35f that don't require mass-editing target specs).
2022-09-01Always import all tracing macros for the entire crate instead of piecemeal ↵Oli Scherer-1/+1
by module
2022-09-01rustc_target: Refactor internal linker flavors slightlyVadim Petrochenkov-12/+2
Remove one unstable user-facing linker flavor (l4-bender)
2022-09-01rustc_target: Add a compatibility layer to separate internal and user-facing ↵Vadim Petrochenkov-2/+2
linker flavors
2022-08-28Support `#[unix_sigpipe = "inherit|sig_dfl|sig_ign"]` on `fn main()`Martin Nordholts-1/+11
This makes it possible to instruct libstd to never touch the signal handler for `SIGPIPE`, which makes programs pipeable by default (e.g. with `./your-program | head -n 1`) without `ErrorKind::BrokenPipe` errors.
2022-08-18session: stabilize split debuginfo on linuxDavid Wood-7/+0
Stabilize the `-Csplit-debuginfo` flag... - ...on Linux for all values of the flag. Split DWARF has been implemented for a few months, hasn't had any bug reports and has had some promising benchmarking for incremental debug build performance. - ..on other platforms for the default value. It doesn't make any sense that `-Csplit-debuginfo=packed` is unstable on Windows MSVC when that's the default behaviour, but keep the other values unstable. Signed-off-by: David Wood <david.wood@huawei.com>
2022-08-12Adjust cfgsMark Rousskov-2/+2
2022-07-31Rollup merge of #99519 - Urgau:check-cfg-implicit, r=petrochenkovMatthias Krüger-14/+0
Remove implicit names and values from `--cfg` in `--check-cfg` This PR remove the implicit names and values from `--cfg` in `--check-cfg` because the behavior is quite surprising but also because it's really easy to inadvertently really on the implicitness and when the `--cfg` is not set anymore to have an unexpected warning from an unexpected condition that pass with the implicitness. This change in behavior will also enable us to warn when an unexpected `--cfg` is passed, ex: the user wrote `--cfg=unstabl` instead of `--cfg=unstable`. The implementation of the warning will be done in a follow-up PR. cc `@petrochenkov`
2022-07-30Auto merge of #99123 - mystor:crossbeam_bridge, r=eddybbors-0/+10
proc_macro: use crossbeam channels for the proc_macro cross-thread bridge This is done by having the crossbeam dependency inserted into the `proc_macro` server code from the server side, to avoid adding a dependency to `proc_macro`. In addition, this introduces a -Z command-line option which will switch rustc to run proc-macros using this cross-thread executor. With the changes to the bridge in #98186, #98187, #98188 and #98189, the performance of the executor should be much closer to same-thread execution. In local testing, the crossbeam executor was substantially more performant than either of the two existing `CrossThread` strategies, so they have been removed to keep things simple. r? `@eddyb`
2022-07-29proc_macro: use crossbeam channels for the proc_macro cross-thread bridgeNika Layzell-0/+10
This is done by having the crossbeam dependency inserted into the proc_macro server code from the server side, to avoid adding a dependency to proc_macro. In addition, this introduces a -Z command-line option which will switch rustc to run proc-macros using this cross-thread executor. With the changes to the bridge in #98186, #98187, #98188 and #98189, the performance of the executor should be much closer to same-thread execution. In local testing, the crossbeam executor was substantially more performant than either of the two existing CrossThread strategies, so they have been removed to keep things simple.
2022-07-29Auto merge of #99467 - BelovDV:add_option_link_arg, r=petrochenkovbors-2/+15
flag '-l link-arg=___ was added #99427
2022-07-27lint: add bad opt access internal lintDavid Wood-0/+4
Some command-line options accessible through `sess.opts` are best accessed through wrapper functions on `Session`, `TyCtxt` or otherwise, rather than through field access on the option struct in the `Session`. Adds a new lint which triggers on those options that should be accessed through a wrapper function so that this is prohibited. Options are annotated with a new attribute `rustc_lint_opt_deny_field_access` which can specify the error message (i.e. "use this other function instead") to be emitted. A simpler alternative would be to simply rename the options in the option type so that it is clear they should not be used, however this doesn't prevent uses, just discourages them. Another alternative would be to make the option fields private, and adding accessor functions on the option types, however the wrapper functions sometimes rely on additional state from `Session` or `TyCtxt` which wouldn't be available in an function on the option type, so the accessor would simply make the field available and its use would be discouraged too. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-26Lib kind -l link-arg:Daniil Belov-2/+15
arbitrary link argument like -C link-arg, but respecting relative order to other `-l` options, unstable
2022-07-20Remove implicit names and values from --cfg in --check-cfgUrgau-14/+0
2022-07-16Do not ICE when we have -Zunpretty=expand with invalid ABIMichael Goulet-0/+8
2022-07-13Rename `debugging_opts` to `unstable_opts`Joshua Nelson-46/+46
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear.
2022-07-06session: `output-width` -> `diagnostic-width`David Wood-6/+6
Rename the `--output-width` flag to `--diagnostic-width` as this appears to be the preferred name within the compiler team. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-06session: `terminal-width` -> `output-width`David Wood-6/+6
Rename the `--terminal-width` flag to `--output-width` as the behaviour doesn't just apply to terminals (and so is slightly less accurate). Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-06sess: stabilize `--terminal-width`David Wood-0/+12
Formerly `-Zterminal-width`, `--terminal-width` allows the user or build tool to inform rustc of the width of the terminal so that diagnostics can be truncated. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-04incr.comp.: Make split-dwarf commandline options [TRACKED].Michael Woerister-2/+3
2022-07-01update cfg(bootstrap)sPietro Albini-43/+0
2022-06-21Auto merge of #97657 - Urgau:check-cfg-many-mut, r=oli-obkbors-34/+89
Use get_many_mut to reduce the cost of setting up check cfg values This PR use the newly added [`get_many_mut`](https://github.com/rust-lang/rust/issues/97601) function in [`HashMap`](https://doc.rust-lang.org/nightly/std/collections/hash_map/struct.HashMap.html#method.get_many_mut) to reduce the cost of setting up the initial check cfg values. cc `@petrochenkov`
2022-06-16Support lint expectations for `--force-warn` lints (RFC 2383)xFrednet-1/+1
2022-06-15Use get_many_mut to reduce the cost of setup ping check cfg valuesUrgau-34/+89
2022-06-09Stabilize the `bundle` native library modifierVadim Petrochenkov-19/+1
2022-06-08bye `BorrowckMode`lcnr-17/+0
2022-06-03Fully stabilize NLLJack Huey-12/+0
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-3/+3
2022-05-15rustc: Stricter checking for #[link] attributesVadim Petrochenkov-59/+45
2022-04-28Auto merge of #96085 - jsgf:deny-unused-deps, r=compiler-errorsbors-5/+33
Make sure `-Dunused-crate-dependencies --json unused-externs` makes rustc exit with error status This PR: - fixes compiletest to understand unused extern notifications - adds tests for `--json unused-externs` - makes sure that deny-level unused externs notifications are treated as compile errors - refactors the `emit_unused_externs` callstack to plumb through the level as an enum as a string, and adds `Level::is_error` Update: adds `--json unused-externs-silent` with the original behaviour since Cargo needs it. Should address `@est31's` concerns. Fixes: https://github.com/rust-lang/rust/issues/96068
2022-04-28Rollup merge of #96483 - Urgau:check-cfg-target_feature, r=petrochenkovDylan DPC-0/+5
Add missing `target_feature` to the list of well known cfg names This PR adds the missing `target_feature` cfg name to the list of well known cfg names. It was notice missing in https://github.com/rust-lang/rust/issues/96472 thanks to `@bjorn3,` the reason being that `--check-cfg=names()` automatically inherit the names passed by `--cfg` (or internal to `rustc`) and is seems that the vast majority of targets have at least one target feature leading to `target_feature` being a well known name in most target but it should always be a well known name so this PR add it unconditionally to list. r? `@petrochenkov`
2022-04-27Add missing `target_feature` to the list of well known cfg namesLoïc BRANSTETT-0/+5
2022-04-27Add --json unused-externs-silent with original behaviourJeremy Fitzhardinge-5/+33
Since Cargo wants to do its own fatal error handling for unused dependencies, add the option `--json unused-externs-silent` which has the original behaviour of not indicating non-zero exit status for `deny`/`forbid`-level unused dependencies.
2022-04-23Add support for `nounused` --extern flagJeremy Fitzhardinge-1/+10
This adds `nounused` to the set of extern flags: `--extern nounused:core=/path/to/core/libcore.rlib`. The effect of this flag is to suppress `unused-crate-dependencies` warnings relating to the crate.
2022-04-20Auto merge of #96082 - michaelwoerister:less_impl_stable_hash_via_hash, ↵bors-19/+16
r=compiler-errors incr. comp.: Don't export impl_stable_hash_via_hash!() and warn about using it. Fixes https://github.com/rust-lang/rust/issues/96013.
2022-04-19incr. comp.: Don't export impl_stable_hash_via_hash!() and warn about using it.Michael Woerister-19/+16
2022-04-15Remove `--extern-location` and all associated codeJeremy Fitzhardinge-116/+0
`--extern-location` was an experiment to investigate the best way to generate useful diagnostics for unused dependency warnings by enabling a build system to identify the corresponding build config. While I did successfully use this, I've since been convinced the alternative `--json unused-externs` mechanism is the way to go, and there's no point in having two mechanisms with basically the same functionality. This effectively reverts https://github.com/rust-lang/rust/pull/72603
2022-04-05errors: implement sysroot/testing bundle loadingDavid Wood-0/+2
Extend loading of Fluent bundles so that bundles can be loaded from the sysroot based on the language requested by the user, or using a nightly flag. Sysroot bundles are loaded from `$sysroot/share/locale/$locale/*.ftl`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-03Cleanup after some refactoring in rustc_targetLoïc BRANSTETT-1/+1
2022-04-03Replace every Vec in Target(Options) with it's Cow equivalentLoïc BRANSTETT-1/+1
2022-03-30Stabilize native library modifier syntax and the `whole-archive` modifier ↵Vadim Petrochenkov-22/+41
specifically
2022-03-24Prettify rustc_session fmt with capturing args (nfc)Jubilee Young-42/+30
2022-03-18Auto merge of #88098 - Amanieu:oom_panic, r=nagisabors-3/+25
Implement -Z oom=panic This PR removes the `#[rustc_allocator_nounwind]` attribute on `alloc_error_handler` which allows it to unwind with a panic instead of always aborting. This is then used to implement `-Z oom=panic` as per RFC 2116 (tracking issue #43596). Perf and binary size tests show negligible impact.
2022-03-09Add miri to the well known conditional compilation names and valuesLoïc BRANSTETT-5/+10
2022-03-06Update -Z unpretty error messageAlex Macleod-4/+3
Adds `thir-tree`, removes `everybody_loops`