about summary refs log tree commit diff
path: root/compiler/rustc_session/src
AgeCommit message (Collapse)AuthorLines
2023-11-02Rollup merge of #117394 - lcnr:proof-tree-cache4, r=compiler-errorsMatthias Krüger-2/+0
use global cache when computing proof trees we're writing the solver while relying on the existence of the global cache to avoid exponential blowup. By disabling the global cache when building proof trees, it is easy to get hangs, e.g. when computing intercrate ambiguity causes. Removes the unstable `-Zdump_solver_proof_tree_use_cache` option, as we now always return a full proof tree. r? `@compiler-errors`
2023-11-02use global cache when computing proof treeslcnr-2/+0
2023-11-02Minimize `pub` usage in `source_map.rs`.Nicholas Nethercote-5/+4
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-24/+12
2023-10-30Make `Cfg` and `CheckCfg` non-generic.Nicholas Nethercote-23/+12
They now only ever contains symbols.
2023-10-30Change cfg parsers to produce symbols instead of strings.Nicholas Nethercote-31/+1
2023-10-28Rollup merge of #117311 - RalfJung:unpretty-thir-help, r=petrochenkovJubilee-0/+1
-Zunpretty help: add missing possible values `-Zunpretty` accepts "thir-tree" and "thir-flat", but that was not shown in `-Zhelp`.
2023-10-28-Zunpretty help: add missing possible valuesRalf Jung-0/+1
2023-10-28Rollup merge of #117268 - nnethercote:rustc_interface, r=oli-obkJubilee-37/+32
`rustc_interface` cleanups Particularly in and around `--cfg` and `--check-cfg` handling. r? `@oli-obk`
2023-10-28Rollup merge of #117256 - dtolnay:currentversion, r=compiler-errorsJubilee-0/+22
Parse rustc version at compile time This PR eliminates a couple awkward codepaths where it was not clear how the compiler should proceed if its own version number is incomprehensible. https://github.com/rust-lang/rust/blob/dab715641e96a61a534587fda9de1128b75b34dc/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs#L385 https://github.com/rust-lang/rust/blob/dab715641e96a61a534587fda9de1128b75b34dc/compiler/rustc_attr/src/builtin.rs#L630 We can guarantee that every compiled rustc comes with a working version number, so the ICE codepaths above shouldn't need to be written.
2023-10-28Rollup merge of #116534 - cjgillot:no-dep-tasks, r=davidtwcoJubilee-3/+0
Remove -Zdep-tasks. This option is not useful any more, we can use `tracing` and `RUSTC_LOG` to debug the dep-graph.
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-35/+27
`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-28Change `CrateConfig` from `FxIndexSet` to `FxHashSet`.Nicholas Nethercote-3/+3
Because its order doesn't matter. This is well demonstrated by `to_crate_config`, which creates a `CrateConfig` from an `FxHashSet`.
2023-10-26Parse rustc version at compile timeDavid Tolnay-0/+22
2023-10-26Rollup merge of #117207 - Zalathar:no-option, r=compiler-errorsMatthias Krüger-16/+14
The value of `-Cinstrument-coverage=` doesn't need to be `Option` (Extracted from #117199, since this is a purely internal cleanup that can land independently.) 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-26The value of `-Cinstrument-coverage=` doesn't need to be `Option`Zalathar-16/+14
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-26Auto merge of #116818 - Nilstrieb:stop-submitting-bug-reports, r=wesleywiserbors-1/+9
Stop telling people to submit bugs for internal feature ICEs This keeps track of usage of internal features, and changes the message to instead tell them that using internal features is not supported. I thought about several ways to do this but now used the explicit threading of an `Arc<AtomicBool>` through `Session`. This is not exactly incremental-safe, but this is fine, as this is set during macro expansion, which is pre-incremental, and also only affects the output of ICEs, at which point incremental correctness doesn't matter much anyways. See [MCP 620.](https://github.com/rust-lang/compiler-team/issues/596) ![image](https://github.com/rust-lang/rust/assets/48135649/be661f05-b78a-40a9-b01d-81ad2dbdb690)
2023-10-25Stop telling people to submit bugs for internal feature ICEsNilstrieb-1/+9
This keeps track of usage of internal features, and changes the message to instead tell them that using internal features is not supported. See MCP 620.
2023-10-25Remove support for alias `-Z instrument-coverage`Zalathar-32/+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-2/+15
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-20s/generator/coroutine/Oli Scherer-1/+1
2023-10-20s/Generator/Coroutine/Oli Scherer-6/+6
2023-10-20slight Default cleanup for optionRémy Rakic-7/+2
2023-10-19Auto merge of #115214 - Urgau:rfc-3127-trim-paths, r=compiler-errorsbors-7/+179
Implement rustc part of RFC 3127 trim-paths This PR implements (or at least tries to) [RFC 3127 trim-paths](https://github.com/rust-lang/rust/issues/111540), the rustc part. That is `-Zremap-path-scope` with all of it's components/scopes. `@rustbot` label: +F-trim-paths
2023-10-17Automatically enable cross-crate inlining for small functionsBen Kimock-0/+2
2023-10-17[RFC 3127 - Trim Paths]: Condition remapped filepath on remap scopesUrgau-5/+123
2023-10-17[RFC 3127 - Trim Paths]: Add unstable option and parsingUrgau-2/+56
2023-10-16Auto merge of #116731 - Alexendoo:hash-untracked-state, r=oli-obkbors-5/+11
Add `Config::hash_untracked_state` callback For context, I'm looking to use [late module passes](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint/context/struct.LintStore.html#structfield.late_module_passes) in Clippy which unlike regular late passes run incrementally per module However we have a config file which can change between runs, we need changes to that to invalidate the `lint_mod` query. This PR adds a side channel for us to hash some extra state into `Options` in order to do that This does not make any changes to Clippy, I plan to do that in a PR to the Clippy repo along with some other required changes An alternative implementation would be to add a new query to track this state and override the `lint_mod` query in Clippy to first call that cc `@rust-lang/clippy`
2023-10-16Rename `ACTIVE_FEATURES` as `UNSTABLE_FEATURES`.Nicholas Nethercote-2/+2
It's a better name, and lets "active features" refer to the features that are active in a particular program, due to being declared or enabled by the edition. The commit also renames `Features::enabled` as `Features::active` to match this; I changed my mind and have decided that "active" is a little better thatn "enabled" for this, particularly because a number of pre-existing comments use "active" in this way. Finally, the commit renames `Status::Stable` as `Status::Accepted`, to match `ACCEPTED_FEATURES`.
2023-10-14Add `Config::hash_untracked_state` callbackAlex Macleod-5/+11
2023-10-13Format all the let chains in compilerMichael Goulet-3/+9
2023-10-13Auto merge of #116619 - nnethercote:rustc_driver_impl, r=compiler-errorsbors-15/+10
Streamline `rustc_driver_impl` pretty-printing. This PR simplifies a lot of unnecessary structure in `rustc_driver_impl/src/pretty.rs`. It removes some traits and functions, simplifies some structs, renames some things for increased consistency, and eliminates some boilerplate code. Overall it cuts more than 150 lines of code. r? `@compiler-errors`
2023-10-13Auto merge of #115964 - bjorn3:cgu_reuse_tracker_global_state, r=cjgillotbors-167/+0
Remove cgu_reuse_tracker from Session This removes a bit of global mutable state. It will now miss post-lto cgu reuse when ThinLTO determines that a cgu doesn't get changed, but there weren't any tests for this anyway and a test for it would be fragile to the exact implementation of ThinLTO in LLVM.
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-1/+51
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-11Auto merge of #116014 - lqd:mcp510-2-electric-boogaloo, r=petrochenkovbors-54/+62
Implement `-Clink-self-contained=-linker` opt out This implements the `-Clink-self-contained` opt out necessary to switch to lld by changing rustc's defaults instead of cargo's. Components that are enabled and disabled on the CLI are recorded, for the purpose of being merged with the ones which the target spec will declare (I'll open another PR for that tomorrow, for easier review). For MCP510, we now check whether using the self-contained linker is disabled on the CLI. Right now it would only be sensible to with `-Zgcc-ld=lld` (and I'll add some checks that we don't both enable and disable a component on the CLI in a future PR), but the goal is to simplify adding the check of the target's enabled components here in the follow-up PRs. r? `@petrochenkov`
2023-10-10Rollup merge of #116595 - RalfJung:mir-enable-passes, r=oli-obkMatthias Krüger-3/+4
-Zmir-enable-passes: document that this may enable unsound passes also add some comments explaining why MIR opts are marked as unsound
2023-10-10-Zmir-enable-passes: document that this may enable unsound passesRalf Jung-3/+4
2023-10-09Remove cgu_reuse_tracker from Sessionbjorn3-161/+0
This removes a bit of global mutable state
2023-10-09Remove an LTO dependent cgu_reuse_tracker.set_actual_reuse callbjorn3-7/+1
2023-10-08consistency check for self-contained linking components CLI optionsRémy Rakic-0/+25
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-7/+7
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-08Remove -Zdep-tasks.Camille GILLOT-3/+0
2023-10-08linker: Remove `-Zgcc-ld` optionVadim Petrochenkov-20/+3
It is subsumed by `-Clinker-flavor=*-lld-cc -Clink-self-contained=+linker` options now