about summary refs log tree commit diff
path: root/compiler/rustc_session/src/config.rs
AgeCommit message (Collapse)AuthorLines
2023-12-02Rename `Handler::delay_good_path_bug` as `Handler::good_path_delayed_bug`.Nicholas Nethercote-3/+6
In line with the previous commits.
2023-12-01Auto merge of #118472 - nnethercote:rustc_session, r=bjorn3bors-46/+52
`rustc_session` cleanups r? `@bjorn3`
2023-12-01Move `WasiExecModel`.Nicholas Nethercote-1/+7
All the other option enums are defined in `config.rs`.
2023-12-01Reduce `pub` exposure.Nicholas Nethercote-1/+1
2023-11-30Add `-Zfunction-return={keep,thunk-extern}` optionMiguel Ojeda-3/+15
This is intended to be used for Linux kernel RETHUNK builds. With this commit (optionally backported to Rust 1.73.0), plus a patched Linux kernel to pass the flag, I get a RETHUNK build with Rust enabled that is `objtool`-warning-free and is able to boot in QEMU and load a sample Rust kernel module. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-11-30Inline and remove `select_debuginfo_compression`.Nicholas Nethercote-9/+1
It's trivial and has a single callsite.
2023-11-30Sort `PRINT_KINDS`.Nicholas Nethercote-13/+15
Alphabetical order is nicer than random order.
2023-11-30Improve integer interning in `default_configuration`.Nicholas Nethercote-10/+9
We have `sym::integer` for interning integers. Using it lets us use symbols directy, and not have to explicitly go through strings.
2023-11-30Move `is_ascii_ident` to where it's used.Nicholas Nethercote-2/+13
2023-11-30Reorder some `use` items.Nicholas Nethercote-10/+6
2023-11-26Serialize OutputFilenames into rmeta filebjorn3-3/+3
This ensures that linking will use the correct crate name even when `#![crate_name = "..."]` is used to specify the crate name.
2023-11-22Auto merge of #118071 - Urgau:check-cfg-cargo-feature, r=petrochenkovbors-2/+1
Remove `feature` from the list of well known check-cfg name This PR removes `feature` from the list of well known check-cfg. This is done for multiple reasons: - Cargo is the source of truth, rustc shouldn't have any knowledge of it - It creates a conflict between Cargo and rustc when there are no features defined. In this case Cargo won't pass any `--check-cfg` for `feature` since no feature will ever be passed, but rustc by having in it's list adds a implicit `cfg(feature, values(any()))` which is completely wrong. Having any cfg `feature` is unexpected not allow any `feature` value. While doing this, I took the opportunity to specialise the diagnostic a bit for the case above. r? `@petrochenkov`
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-1/+1
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-11-21Remove `feature` from the list of well known check-cfg nameUrgau-2/+1
2023-11-17change smir to StableMirOğuz Ağcayazı-7/+7
2023-11-17emit basic smirOğuz Ağcayazı-3/+7
2023-11-11Auto merge of #115694 - clarfonthey:std-hash-private, r=dtolnaybors-2/+1
Add `std::hash::{DefaultHasher, RandomState}` exports (needs FCP) This implements rust-lang/libs-team#267 to move the libstd hasher types to `std::hash` where they belong, instead of `std::collections::hash_map`. <details><summary>The below no longer applies, but is kept for clarity.</summary> This is a small refactor for #27242, which moves the definitions of `RandomState` and `DefaultHasher` into `std::hash`, but in a way that won't be noticed in the public API. I've opened rust-lang/libs-team#267 as a formal ACP to move these directly into the root of `std::hash`, but for now, they're at least separated out from the collections code in a way that will make moving that around easier. I decided to simply copy the rustdoc for `std::hash` from `core::hash` since I think it would be ideal for the two to diverge longer-term, especially if the ACP is accepted. However, I would be willing to factor them out into a common markdown document if that's preferred. </details>
2023-11-08Rollup merge of #117650 - saethlin:inline-me-please, r=davidtwcoMatthias Krüger-4/+18
Add -Zcross-crate-inline-threshold=yes ``@thomcc`` says this would be useful for > seeing if it makes a difference in some code if i do it when building the sysroot, since -Zbuild-std + lto helps more than it seems like it should And I've changed the possible values as a reference to ``@Manishearth`` saying > LLVM's inlining heuristic is "yes".
2023-11-07Add -Zcross-crate-inline-threshold=yesBen Kimock-4/+18
2023-11-08rustc: minor changes suggested by clippy perf lints.Nicholas Nethercote-1/+1
2023-11-03Auto merge of #117507 - nnethercote:rustc_span, r=Nilstriebbors-3/+2
`rustc_span` cleanups Just some things I found while looking over this crate. r? `@oli-obk`
2023-11-02Add insta-stable std::hash::{DefaultHasher, RandomState} exportsltdk-2/+1
2023-11-02Minimize `pub` usage in `source_map.rs`.Nicholas Nethercote-3/+2
Most notably, this commit changes the `pub use crate::*;` in that file to `use crate::*;`. This requires a lot of `use` items in other crates to be adjusted, because everything defined within `rustc_span::*` was also available via `rustc_span::source_map::*`, which is bizarre. The commit also removes `SourceMap::span_to_relative_line_string`, which is unused.
2023-11-02Remove support for alias `-Z symbol-mangling-version`Zalathar-21/+12
2023-10-30Make `Cfg` and `CheckCfg` non-generic.Nicholas Nethercote-21/+10
They now only ever contains symbols.
2023-10-30Change cfg parsers to produce symbols instead of strings.Nicholas Nethercote-31/+1
2023-10-28Change `Cfg<T>` to an `FxIndexSet`.Nicholas Nethercote-2/+5
Despite what I claimed in an earlier commit, the ordering does matter to some degree. Using `FxIndexSet` prevents changes to the error message order in `tests/ui/check-cfg/mix.rs`.
2023-10-28Clean up config mess.Nicholas Nethercote-25/+22
`parse_cfgspecs` and `parse_check_cfg` run very early, before the main interner is running. They each use a short-lived interner and convert all interned symbols to strings in their output data structures. Once the main interner starts up, these data structures get converted into new data structures that are identical except with the strings converted to symbols. All is not obvious from the current code, which is a mess, particularly with inconsistent naming that obscures the parallel string/symbol data structures. This commit clean things up a lot. - The existing `CheckCfg` type is generic, allowing both `CheckCfg<String>` and `CheckCfg<Symbol>` forms. This is really useful, but it defaults to `String`. The commit removes the default so we have to use `CheckCfg<String>` and `CheckCfg<Symbol>` explicitly, which makes things clearer. - Introduces `Cfg`, which is generic over `String` and `Symbol`, similar to `CheckCfg`. - Renames some things. - `parse_cfgspecs` -> `parse_cfg` - `CfgSpecs` -> `Cfg<String>`, plus it's used in more places, rather than the underlying `FxHashSet` type. - `CrateConfig` -> `Cfg<Symbol>`. - `CrateCheckConfig` -> `CheckCfg<Symbol>` - Adds some comments explaining the string-to-symbol conversions. - `to_crate_check_config`, which converts `CheckCfg<String>` to `CheckCfg<Symbol>`, is inlined and removed and combined with the overly-general `CheckCfg::map_data` to produce `CheckCfg::<String>::intern`. - `build_configuration` now does the `Cfg<String>`-to-`Cfg<Symbol>` conversion, so callers don't need to, which removes the need for `to_crate_config`. The diff for two of the fields in `Config` is a good example of the improved clarity: ``` - pub crate_cfg: FxHashSet<(String, Option<String>)>, - pub crate_check_cfg: CheckCfg, + pub crate_cfg: Cfg<String>, + pub crate_check_cfg: CheckCfg<String>, ``` Compare that with the diff for the corresponding fields in `ParseSess`, and the relationship to `Config` is much clearer than before: ``` - pub config: CrateConfig, - pub check_config: CrateCheckConfig, + pub config: Cfg<Symbol>, + pub check_config: CheckCfg<Symbol>, ```
2023-10-26The value of `-Cinstrument-coverage=` doesn't need to be `Option`Zalathar-7/+5
Not using this flag is identical to passing `-Cinstrument-coverage=off`, so there's no need to distinguish between `None` and `Some(Off)`.
2023-10-25Remove support for alias `-Z instrument-coverage`Zalathar-22/+17
This flag was stabilized in rustc 1.60.0 as `-C instrument-coverage`, but the old unstable flag was kept around as an alias to ease migration.
2023-10-24Introduce `-C instrument-coverage=branch` to gate branch coverageArpad Borsos-1/+7
This flag has to be used in combination with `-Zunstable-options`, and is added in advance of adding branch coverage instrumentation.
2023-10-23Rollup merge of #116960 - lqd:applied-member-constraints-scope, r=matthewjasperMatthias Krüger-7/+2
Location-insensitive polonius: consider a loan escaping if an SCC has member constraints applied only The location-insensitive analysis considered loans to escape if there were member constraints, which makes *some* sense for scopes and matches the scopes that NLL computes on all the tests. However, polonius and NLLs differ on the fuzzed case #116657, where an SCC has member constraints but no applied ones (and is kinda surprising). The existing UI tests with member constraints impacting scopes all have some constraint applied. This PR changes the location-insensitive analysis to consider a loan to escape if there are applied member constraints, and for extra paranoia/insurance via fuzzing and crater: actually checks the constraint's min choice is indeed a universal region as we expect. (This could be turned into a `debug_assert` and early return as a slight optimization after these periods of verification) The 4 UI tests where member constraints are meaningful for computing scopes still pass obviously, and this also fixes #116657. r? `@matthewjasper`
2023-10-20slight Default cleanup for optionRémy Rakic-7/+2
2023-10-17[RFC 3127 - Trim Paths]: Condition remapped filepath on remap scopesUrgau-3/+19
2023-10-17[RFC 3127 - Trim Paths]: Add unstable option and parsingUrgau-2/+29
2023-10-14Add `Config::hash_untracked_state` callbackAlex Macleod-5/+6
2023-10-13Make `needs_analysis` true for `PpHirMode::Typed`.Nicholas Nethercote-1/+1
This avoids the need for a bespoke `tcx.analysis()` call.
2023-10-13Remove PpAstTreeMode.Nicholas Nethercote-14/+9
It's simpler to distinguish the two AST modes directly in `PpMode`.
2023-10-11Auto merge of #113218 - lqd:polonius-scopes, r=jackh726bors-0/+34
Compute NLL loan scopes using the polonius model For a *location-insensitive* analysis (that is, without expressiveness improvements for users yet), this PR implements loans going out of scope using reachability and liveness, rather than checking if the issuing region's values contain a given CFG point. This is equivalent to NLL scopes and computes the same data. r? `@matthewjasper` A couple of notes: - there are some assumptions about SCC representatives, placeholders, free regions, and member constraints that I believe hold, and they're documented in the code - this passes all the UI tests with `-Zpolonius=next` -- the perf is [not terrible](https://github.com/rust-lang/rust/pull/112432#issuecomment-1749685862) and there are a bunch of ways to improve it in the future. - there's a fixme left, hopefully Matthew you know a clean way to get the information it mentions.
2023-10-08consistency check for self-contained linking components CLI optionsRémy Rakic-0/+24
emit an error if components are both enabled and disabled on the CLI
2023-10-08implement opt out `-Clink-self-contained=-linker`Rémy Rakic-12/+30
record both enabled and disabled components so that they can be merged with the ones that the target spec will define
2023-10-08move single component parsing to dedicated functionRémy Rakic-6/+6
this will prevent parsing when expecting more than a single component to be parsed, and prepare for the symetric variant-to-name function to be added
2023-10-08move `LinkSelfContainedComponents` to `rustc_target`Rémy Rakic-35/+1
2023-10-08prepare stabilization of modern linker-flavorsRémy Rakic-3/+2
fix a few comments
2023-10-08linker: Remove `-Zgcc-ld` optionVadim Petrochenkov-4/+3
It is subsumed by `-Clinker-flavor=*-lld-cc -Clink-self-contained=+linker` options now
2023-10-06Remove unused `FileName::CfgSpec`.Nicholas Nethercote-1/+0
2023-10-04extend Polonius options helpersRémy Rakic-1/+6
2023-10-04introduce `Polonius` enum for `-Zpolonius`Rémy Rakic-0/+29
this allows to opt into using the legacy version or the in-tree prototype
2023-09-22Auto merge of #116001 - fmease:validate-crate-name-extern-cli-opt, r=est31bors-0/+13
[breaking change] Validate crate name in `--extern` [MCP 650] Reject non-ASCII-identifier crate names passed to the CLI option `--extern` (`rustc`, `rustdoc`). Implements [MCP 650](https://github.com/rust-lang/compiler-team/issues/650) (except that we only allow ASCII identifiers not arbitrary Rust identifiers). Fixes #113035. [As mentioned on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Disallow.20non-identifier-valid.20--extern.20cr.E2.80.A6.20compiler-team.23650/near/376826988), doing a crater run probably doesn't make sense since it wouldn't yield anything. Most users don't interact with `rustc` directly but only ever through Cargo which always passes a valid crate name to `--extern` when it invokes `rustc` and `rustdoc`. In any case, the user wouldn't be able to use such a crate name in the source code anyway. Note that I'm not using [`rustc_session::output::validate_crate_name`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/output/fn.validate_crate_name.html) (used for `--crate-name` and `#![crate_name]`) since the latter doesn't reject non-ASCII crate names and ones that start with a digit. As an aside, I've also thought about getting rid of `validate_crate_name` entirely in a separate PR (with another MCP) in favor of `is_ascii_ident` to reject more weird `--crate-name`s, `#![crate_name]`s and file names but I think that would lead to a lot of actual breakage, namely because of file names starting with a digit. In `tests/ui` 9 tests would be impacted for example. CC `@estebank` r? `@est31`
2023-09-20Validate crate name in CLI option --externLeón Orell Valerian Liehr-0/+13