summary refs log tree commit diff
path: root/compiler/rustc_session/src/options.rs
AgeCommit message (Collapse)AuthorLines
2024-03-15Rollup merge of #121207 - chriswailes:z-external-clangrt, r=michaelwoeristerMatthias Krüger-0/+2
Add `-Z external-clangrt` This adds the unstable `-Z external-clangrt` flag that will prevent rustc from emitting linker paths for the in-tree LLVM sanitizer runtime library.
2024-03-13Add `-Z external-sanitizer-runtime`Chris Wailes-0/+2
This adds the unstable `-Z external-sanitizer-runtime` flag that will prevent rustc from emitting linker paths for the in-tree LLVM sanitizer runtime library.
2024-03-13extend docs of -Zprint-mono-itemsRalf Jung-1/+3
2024-03-13Rollup merge of #122226 - Zalathar:zcoverage-options, r=nnethercoteMatthias Krüger-16/+27
coverage: Remove or migrate all unstable values of `-Cinstrument-coverage` (This PR was substantially overhauled from its original version, which migrated all of the existing unstable values intact.) This PR takes the three nightly-only values that are currently accepted by `-Cinstrument-coverage`, completely removes two of them (`except-unused-functions` and `except-unused-generics`), and migrates the third (`branch`) over to a newly-introduced unstable flag `-Zcoverage-options`. I have a few motivations for wanting to do this: - It's unclear whether anyone actually uses the `except-unused-*` values, so this serves as an opportunity to either remove them, or prompt existing users to object to their removal. - After #117199, the stable values of `-Cinstrument-coverage` treat it as a boolean-valued flag, so having nightly-only extra values feels out-of-place. - Nightly-only values also require extra ad-hoc code to make sure they aren't accidentally exposed to stable users. - The new system allows multiple different settings to be toggled independently, which isn't possible in the current single-value system. - The new system makes it easier to introduce new behaviour behind an unstable toggle, and then gather nightly-user feedback before possibly making it the default behaviour for all users. - The new system also gives us a convenient place to put relatively-narrow options that won't ever be the default, but that nightly users might still want access to. - It's likely that we will eventually want to give stable users more fine-grained control over coverage instrumentation. The new flag serves as a prototype of what that stable UI might eventually look like. The `branch` option is a placeholder that currently does nothing. It will be used by #122322 to opt into branch coverage instrumentation. --- I see `-Zcoverage-options` as something that will exist more-or-less indefinitely, though individual sub-options might come and go as appropriate. I think there will always be some demand for nightly-only toggles, so I don't see `-Zcoverage-options` itself ever being stable, though we might eventually stabilize something similar to it.
2024-03-13Auto merge of #122227 - Zoxc:query-hash-verify, r=michaelwoeristerbors-1/+3
Verify that query keys result in unique dep nodes This implements checking that query keys result into unique dep nodes as mentioned in https://github.com/rust-lang/rust/pull/112469. We could do a perf check to see how expensive this is. r? `@michaelwoerister`
2024-03-13coverage: Add `-Zcoverage-options` for fine control of coverageZalathar-0/+21
This new nightly-only flag can be used to toggle fine-grained flags that control the details of coverage instrumentation. Currently the only supported flag value is `branch` (or `no-branch`), which is a placeholder for upcoming support for branch coverage. Other flag values can be added in the future, to prototype proposed new behaviour, or to enable special non-default behaviour.
2024-03-13coverage: Remove all unstable values of `-Cinstrument-coverage`Zalathar-16/+6
2024-03-12Verify that query keys result in unique dep nodesJohn Kåre Alsaker-1/+3
2024-03-11Rollup merge of #116791 - WaffleLapkin:unparallel-backends, r=oli-obkJubilee-1/+1
Allow codegen backends to opt-out of parallel codegen This makes it a bit easier to write cursed codegen backends.
2024-03-06Rollup merge of #121382 - nnethercote:rework-untranslatable_diagnostic-lint, ↵Matthias Krüger-0/+1
r=davidtwco Rework `untranslatable_diagnostic` lint Currently it only checks calls to functions marked with `#[rustc_lint_diagnostics]`. This PR changes it to check calls to any function with an `impl Into<{D,Subd}iagnosticMessage>` parameter. This greatly improves its coverage and doesn't rely on people remembering to add `#[rustc_lint_diagnostics]`. It also lets us add `#[rustc_lint_diagnostics]` to a number of functions that don't have an `impl Into<{D,Subd}iagnosticMessage>`, such as `Diag::span`. r? ``@davidtwco``
2024-03-06Change the documented implicit value of `-C instrument-coverage` to `=yes`Zalathar-12/+11
2024-03-06Rewrite the `untranslatable_diagnostic` lint.Nicholas Nethercote-0/+1
Currently it only checks calls to functions marked with `#[rustc_lint_diagnostics]`. This commit changes it to check calls to any function with an `impl Into<{D,Subd}iagMessage>` parameter. This greatly improves its coverage and doesn't rely on people remembering to add `#[rustc_lint_diagnostics]`. The commit also adds `#[allow(rustc::untranslatable_diagnostic)`] attributes to places that need it that are caught by the improved lint. These places that might be easy to convert to translatable diagnostics. Finally, it also: - Expands and corrects some comments. - Does some minor formatting improvements. - Adds missing `DecorateLint` cases to `tests/ui-fulldeps/internal-lints/diagnostics.rs`.
2024-03-05Limit the number of names and values in check-cfg diagnosticsUrgau-0/+2
2024-03-01Add initial support for DataFlowSanitizerRamon de C Valle-2/+18
Adds initial support for DataFlowSanitizer to the Rust compiler. It currently supports `-Zsanitizer-dataflow-abilist`. Additional options for it can be passed to LLVM command line argument processor via LLVM arguments using `llvm-args` codegen option (e.g., `-Cllvm-args=-dfsan-combine-pointer-labels-on-load=false`).
2024-02-15Replace `NonZero::<_>::new` with `NonZero::new`.Markus Reiter-1/+1
2024-02-15Use generic `NonZero` internally.Markus Reiter-5/+8
2024-02-15Rename `-Zno_parallel_llvm` -> `-Zno_parallel_backend`Maybe Waffle-1/+1
2024-02-07Rollup merge of #119162 - heiher:direct-access-external-data, r=petrochenkovGuillaume Boisseau-0/+2
Add unstable `-Z direct-access-external-data` cmdline flag for `rustc` The new flag has been described in the Major Change Proposal at https://github.com/rust-lang/compiler-team/issues/707 Fixes #118053
2024-01-26MCP #705: Provide the option `-Csymbol-mangling-version=hashed -Z ↵h1467792822-2/+4
unstable-options` to shorten symbol names by replacing them with a digest. Enrich test cases
2024-01-20Track `verbose` and `verbose_internals`jyn-2/+2
bjorn3 says: > On errors we don't finalize the incr comp cache, but non-fatal diagnostics are cached afaik. Otherwise we would have to replay the query in question, which we may not be able to do if the query key is not reconstructible from the dep node fingerprint. So we must track these flags to avoid replaying incorrect diagnostics.
2024-01-18Rollup merge of #119828 - azhogin:azhogin/collapse_debuginfo_improved_attr, ↵Matthias Krüger-0/+17
r=petrochenkov Improved collapse_debuginfo attribute, added command-line flag Improved attribute collapse_debuginfo with variants: `#[collapse_debuginfo=(no|external|yes)]`. Added command-line flag for default behaviour. Work-in-progress: will add more tests. cc https://github.com/rust-lang/rust/issues/100758
2024-01-17Add -Zno-implied-bounds-compat option and use itJack Huey-0/+2
2024-01-17Improved collapse_debuginfo attribute, added command-line flag (no|external|yes)Andrew Zhogin-0/+17
2024-01-16Add unstable `-Z direct-access-external-data` cmdline flag for `rustc`WANG Rui-0/+2
The new flag has been described in the Major Change Proposal at https://github.com/rust-lang/compiler-team/issues/707
2024-01-15Replace `TrimmedDefPaths` with a bool.Nicholas Nethercote-1/+1
It's a tri-state enum but the `Always` variant is never used, so a bool is simpler.
2024-01-12Give me a way to emit all the delayed bugsMichael Goulet-0/+3
2024-01-09Rollup merge of #118680 - djkoloski:shell_argfiles, r=compiler-errorsGuillaume Gomez-0/+2
Add support for shell argfiles Closes https://github.com/rust-lang/compiler-team/issues/684
2024-01-09Rollup merge of #119723 - nnethercote:rm-Zdont-buffer-diagnostics, ↵Guillaume Gomez-3/+0
r=compiler-errors Remove `-Zdont-buffer-diagnostics`. It was added in #54232. It seems like it was aimed at NLL development, which is well in the past. Also, it looks like `-Ztreat-err-as-bug` can be used to achieve the same effect. So it doesn't seem necessary. r? ``@pnkfelix``
2024-01-09Rollup merge of #117744 - quininer:add-z-sync-uw, r=bjorn3Matthias Krüger-0/+2
Add -Zuse-sync-unwind Currently Rust uses async unwind by default, but async unwind will bring non-negligible size overhead. it would be nice to allow users to choose this. In addition, async unwind currently prevents LLVM from generate compact unwind for MachO, if one wishes to generate compact unwind for MachO, then also needs this flag.
2024-01-09Remove `-Zdont-buffer-diagnostics`.Nicholas Nethercote-3/+0
It was added in #54232. It seems like it was aimed at NLL development, which is well in the past. Also, it looks like `-Ztreat-err-as-bug` can be used to achieve the same effect. So it doesn't seem necessary.
2024-01-08Add support for shell argfilesDavid Koloski-0/+2
2024-01-05Rollup merge of #119567 - nnethercote:rm-Zreport-delayed-bugs, r=oli-obkMichael Goulet-2/+0
Remove `-Zreport-delayed-bugs`. It's not used within the repository in any way (e.g. in tests), and doesn't seem useful. It was added in #52568. r? ````@oli-obk````
2024-01-05Rollup merge of #119566 - Zalathar:remove-spanview, r=Swatinem,NilstriebMichael Goulet-29/+0
Remove `-Zdump-mir-spanview` The `-Zdump-mir-spanview` flag was added back in #76074, as a development/debugging aid for the initial work on what would eventually become `-Cinstrument-coverage`. It causes the compiler to emit an HTML file containing a function's source code, with various spans highlighted based on the contents of MIR. When the suggestion was made to [triage and remove unnecessary `-Z` flags (Zulip)](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.60-Z.60.20option.20triage), I noted that this flag could potentially be worth removing, but I wanted to keep it around to see whether I found it useful for my own coverage work. But when I actually tried to use it, I ran into various issues (e.g. it crashes on `tests/coverage/closure.rs`). If I can't trust it to work properly without a full overhaul, then instead of diving down a rabbit hole of trying to fix arcane span-handling bugs, it seems better to just remove this obscure old code entirely. --- ````@rustbot```` label +A-code-coverage
2024-01-05Stabilize THIR unsafeckMatthew Jasper-2/+2
2024-01-04Remove `-Zreport-delayed-bugs`.Nicholas Nethercote-2/+0
It's not used within the repository in any way (e.g. in tests), and doesn't seem useful.
2024-01-04Remove `-Zdump-mir-spanview`Zalathar-29/+0
2023-12-31Add -Zuse-sync-unwindquininer-0/+2
This flag specifies whether LLVM generates async unwind or sync unwind.
2023-12-26Auto merge of #119129 - jyn514:verbose, r=compiler-errors,estebankbors-2/+4
rework `-Zverbose` implements the changes described in https://github.com/rust-lang/compiler-team/issues/706 the first commit is only a name change from `-Zverbose` to `-Zverbose-internals` and does not change behavior. the second commit changes diagnostics. possible follow up work: - `ty::pretty` could print more info with `--verbose` than it does currently. `-Z verbose-internals` shows too much info in a way that's not helpful to users. michael had ideas about this i didn't fully understand: https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/uplift.20some.20-Zverbose.20calls.20and.20rename.20to.E2.80.A6.20compiler-team.23706/near/408984200 - `--verbose` should imply `-Z write-long-types-to-disk=no`. the code in `ty_string_with_limit` should take `--verbose` into account (apparently this affects `Ty::sort_string`, i'm not familiar with this code). writing a file to disk should suggest passing `--verbose`. r? `@compiler-errors` cc `@estebank`
2023-12-24don't elide shared parts of types in diagnostics when `--verbose` is passedjyn-0/+2
this also changes some parts of lifetime printing, which previously were not gated behind `-Z verbose`
2023-12-22Rollup merge of #119171 - nnethercote:cleanup-errors-4, r=compiler-errorsMichael Goulet-3/+3
Cleanup error handlers: round 4 More `rustc_errors` cleanups. A sequel to #118933. r? `@compiler-errors`
2023-12-23Rename `EarlyDiagCtxt` methods to match `DiagCtxt`.Nicholas Nethercote-3/+3
- `early_error_no_abort` -> `early_err` - `early_error` -> `early_fatal` - `early_struct_error` -> `early_struct_fatal`
2023-12-21Add pass to identify undefined or erroneous behaviourTomasz Miąsko-0/+2
2023-12-19rename to verbose-internalsjyn-2/+2
2023-12-18Rename many `EarlyDiagCtxt` arguments.Nicholas Nethercote-6/+6
2023-12-18Rename `EarlyErrorHandler` as `EarlyDiagCtxt`.Nicholas Nethercote-3/+3
2023-12-14rename `-Ztrait-solver` to `-Znext-solver`lcnr-29/+44
2023-12-13Add unstable `-Zdefault-hidden-visibility` cmdline flag for `rustc`.Lukasz Anforowicz-0/+2
The new flag has been described in the Major Change Proposal at https://github.com/rust-lang/compiler-team/issues/656
2023-12-10Auto merge of #118368 - GuillaumeGomez:env-flag, r=Nilstriebbors-0/+4
Implement `--env` compiler flag (without `tracked_env` support) Part of https://github.com/rust-lang/rust/issues/80792. Implementation of https://github.com/rust-lang/compiler-team/issues/653. Not an implementation of https://github.com/rust-lang/rfcs/pull/2794. It adds the `--env` compiler flag option which allows to set environment values used by `env!` and `option_env!`. Important to note: When trying to retrieve an environment variable value, it will first look into the ones defined with `--env`, and if there isn't one, then only it will look into the environment variables. So if you use `--env PATH=a`, then `env!("PATH")` will return `"a"` and not the actual `PATH` value. As mentioned in the title, `tracked_env` support is not added here. I'll do it in a follow-up PR. r? rust-lang/compiler
2023-12-10Implement `--env` compiler flagGuillaume Gomez-0/+4
2023-12-07Add emulated TLS supportquininer-0/+2
Currently LLVM uses emutls by default for some targets (such as android, openbsd), but rust does not use it, because `has_thread_local` is false. This commit has some changes to allow users to enable emutls: 1. add `-Zhas-thread-local` flag to specify that std uses `#[thread_local]` instead of pthread key. 2. when using emutls, decorate symbol names to find thread local symbol correctly. 3. change `-Zforce-emulated-tls` to `-Ztls-model=emulated` to explicitly specify whether to generate emutls.