about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
AgeCommit message (Collapse)AuthorLines
2023-02-22Auto merge of #103042 - davidtwco:translation-distributed-ftl, r=oli-obkbors-1/+13
errors: generate typed identifiers in each crate Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. There are advantages and disadvantages to this change.. #### Advantages - Changing a diagnostic now only recompiles the crate for that diagnostic and those crates that depend on it, rather than `rustc_error_messages` and all crates thereafter. - This approach can be used to support first-party crates that want to supply translatable diagnostics (e.g. `rust-lang/thorin` in https://github.com/rust-lang/rust/pull/102612#discussion_r985372582, cc `@JhonnyBillM)` - We can extend this a little so that tools built using rustc internals (like clippy or rustdoc) can add their own diagnostic resources (much more easily than those resources needing to be available to `rustc_error_messages`) #### Disadvantages - Crates can only refer to the diagnostic messages defined in the current crate (or those from dependencies), rather than all diagnostic messages. - `rustc_driver` (or some other crate we create for this purpose) has to directly depend on *everything* that has error messages. - It already transitively depended on all these crates. #### Pending work - [x] I don't know how to make `rustc_codegen_gcc`'s translated diagnostics work with this approach - because `rustc_driver` can't depend on that crate and so can't get its resources to provide to the diagnostic emission. I don't really know how the alternative codegen backends are actually wired up to the compiler at all. - [x] Update `triagebot.toml` to track the moved FTL files. r? `@compiler-errors` cc #100717
2023-02-22various: translation resources from cg backendDavid Wood-1/+4
Extend `CodegenBackend` trait with a function returning the translation resources from the codegen backend, which can be added to the complete list of resources provided to the emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-22errors: generate typed identifiers in each crateDavid Wood-1/+10
Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-22Auto merge of #108300 - oli-obk:elsa, r=eholkbors-4/+2
Use a lock-free datastructure for source_span follow up to the perf regression in https://github.com/rust-lang/rust/pull/105462 The main regression is likely the CStore, but let's evaluate the perf impact of this on its own
2023-02-21Rollup merge of #108285 - BoxyUwU:remove_pick_stable_before_unstable_flag, ↵Dylan DPC-1/+0
r=oli-obk remove unstable `pick_stable_methods_before_any_unstable` flag This flag was only added in #90329 in case there was any issue with the impl so that it would be easy to tell nightly users to use the flag to disable the new logic to fix their code. It's now been enabled for two years and also I can't find any issues corresponding to this new functionality? This flag made it way harder to understand how this code works so it would be nice to remove it and simplify what's going on. cc `@nbdd0121` r? `@oli-obk`
2023-02-21Use a lock-free datastructure for `source_span`Oli Scherer-4/+2
2023-02-21Auto merge of #105462 - oli-obk:feeding_full, r=cjgillot,petrochenkovbors-60/+68
give the resolver access to TyCtxt The resolver is now created after TyCtxt is created. Then macro expansion and name resolution are run and the results fed into queries just like before this PR. Since the resolver had (before this PR) mutable access to the `CStore` and the source span table, these two datastructures are now behind a `RwLock`. To ensure that these are not mutated anymore after the resolver is done, a read lock to them is leaked right after the resolver finishes. ### PRs split out of this one and leading up to it: * https://github.com/rust-lang/rust/pull/105423 * https://github.com/rust-lang/rust/pull/105357 * https://github.com/rust-lang/rust/pull/105603 * https://github.com/rust-lang/rust/pull/106776 * https://github.com/rust-lang/rust/pull/106810 * https://github.com/rust-lang/rust/pull/106812 * https://github.com/rust-lang/rust/pull/108032
2023-02-20remove flagBoxy-1/+0
2023-02-20Remove some unnecessary tcx-passingOli Scherer-7/+4
2023-02-20Stop passing in values that one can also get from the tcx lazilyOli Scherer-7/+1
2023-02-20Move the resolver into a queryOli Scherer-28/+35
2023-02-20Make `configure_and_expand` "infalllible" by just aborting the compilation ↵Oli Scherer-15/+13
if it fails instead of bubbling out an error
2023-02-20Use tcx queries instead of passing the values to `configure_and_expand`.Oli Scherer-13/+8
2023-02-20Stuff a TyCtxt into the ResolverOli Scherer-2/+1
2023-02-20Run the resolver after TyCtxt constructionOli Scherer-38/+53
2023-02-20Make untracked.cstore lockable so that resolution can still write to it when ↵Oli Scherer-1/+4
using TyCtxt
2023-02-19Make public API, docs algorithm-agnosticJacob Pratt-1/+1
2023-02-16Remove save-analysis.Nicholas Nethercote-1/+0
Most tests involving save-analysis were removed, but I kept a few where the `-Zsave-analysis` was an add-on to the main thing being tested, rather than the main thing being tested. For `x.py install`, the `rust-analysis` target has been removed. For `x.py dist`, the `rust-analysis` target has been kept in a degenerate form: it just produces a single file `reduced.json` indicating that save-analysis has been removed. This is necessary for rustup to keep working. Closes #43606.
2023-02-14Simplify expansion logicOli Scherer-3/+3
2023-02-14Inline the expansion queryOli Scherer-28/+23
2023-02-14Remove BoxedResolverOli Scherer-102/+18
2023-02-14Separate the lifetime of the session and the arena in the resolverOli Scherer-4/+10
2023-02-13rustc_resolve: Remove `Resolver::clone_output`Vadim Petrochenkov-23/+10
And remove `Clone` impls and `Lrc`s that are no longer necessary
2023-02-10Rollup merge of #107831 - nnethercote:query-refactoring, r=oli-obkMatthias Krüger-35/+20
Query refactoring Just some cleanups I found when learning about the query system. Best reviewed one commit at a time. r? `@oli-obk`
2023-02-10Auto merge of #102963 - ilammy:xray-basic, r=estebankbors-0/+2
Add `-Z instrument-xray` flag Implement MCP https://github.com/rust-lang/compiler-team/issues/561, adding `-Z instrument-xray` flag which enables XRay instrumentation in LLVM.
2023-02-09Remove `QueryContext`.Nicholas Nethercote-34/+19
There is a type `QueryCtxt`, which impls the trait `QueryContext`. Confusingly, there is another type `QueryContext`. The latter is (like `TyCtxt`) just a pointer to a `GlobalContext`. It's not used much, e.g. its `impl` block has a single method. This commit removes `QueryContext`, replacing its use with direct `GlobalCtxt` use.
2023-02-09Simplify `tls::enter_context`.Nicholas Nethercote-2/+2
2023-02-09Parse "-Z instrument-xray" codegen optionOleksii Lozovskyi-0/+2
Recognize all bells and whistles that LLVM's XRay pass is capable of. The always/never settings are a bit dumb without attributes but they're still there. The default instruction count is chosen by the compiler, not LLVM pass. We'll do it later.
2023-02-07Replace a command line flag with an env var to allow tools to initialize the ↵Oli Scherer-1/+0
tracing loggers at their own discretion
2023-02-05rustc_interface: remove huge error importsest31-18/+16
2023-01-30session: diagnostic migration lint on more fnsDavid Wood-15/+33
Apply the diagnostic migration lint to more functions on `Session`. Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-29Auto merge of #106227 - bryangarza:ctfe-limit, r=oli-obkbors-0/+1
Use stable metric for const eval limit instead of current terminator-based logic This patch adds a `MirPass` that inserts a new MIR instruction `ConstEvalCounter` to any loops and function calls in the CFG. This instruction is used during Const Eval to count against the `const_eval_limit`, and emit the `StepLimitReached` error, replacing the current logic which uses Terminators only. The new method of counting loops and function calls should be more stable across compiler versions (i.e., not cause crates that compiled successfully before, to no longer compile when changes to the MIR generation/optimization are made). Also see: #103877
2023-01-27Compute generator saved locals on MIR.Camille GILLOT-0/+9
2023-01-23Replace terminator-based const eval limitBryan Garza-0/+1
- Remove logic that limits const eval based on terminators, and use the stable metric instead (back edges + fn calls) - Add unstable flag `tiny-const-eval-limit` to add UI tests that do not have to go up to the regular 2M step limit
2023-01-23Store the gctxt instead of fetching it twice.Oli Scherer-1/+1
2023-01-23Make `output_filenames` a real queryOli Scherer-27/+13
2023-01-23Remove another unneeded use of the resolverOli Scherer-19/+23
2023-01-20Auto merge of #106090 - WaffleLapkin:dereffffffffff, r=Nilstriebbors-4/+3
Remove some `ref` patterns from the compiler Previous PR: https://github.com/rust-lang/rust/pull/105368 r? `@Nilstrieb`
2023-01-17Don't call closures immediately, use `try{}` blocksMaybe Waffle-4/+3
2023-01-16Avoid one more call site to `Compiler::expansion`Oli Scherer-1/+1
2023-01-16Move compiler input and ouput paths into sessionOli Scherer-58/+42
2023-01-16Group some commonly passed together values into a structOli Scherer-52/+34
2023-01-16Remove redundant `input_path` field from `Config`Oli Scherer-5/+2
2023-01-16remove some arguments that can also be fed at the caller sideOli Scherer-34/+26
2023-01-16Remove `prepare_outputs`Oli Scherer-19/+9
2023-01-13Rollup merge of #106678 - Veykril:proc-macro-panic-abort, r=eholkMatthias Krüger-1/+11
Warn when using panic-strategy abort for proc-macro crates See https://github.com/rust-lang/rust/issues/82320, this simply warns for now as that seems like the best step that can be immediately taken (opposed to straight up rejecting or ignoring)
2023-01-13Rollup merge of #104645 - yukiomoto:log-backtrace-option, r=oli-obkMatthias Krüger-0/+1
Add log-backtrace option to show backtraces along with logging according to #90698, I added a compiler option, `-Zlog-backtrace=filter`, where `filter` is a module name, to show backtraces for logging without rebuilding. resolve #90698
2023-01-13Warn when using panic-strategy abort for proc-macro cratesLukas Wirth-1/+11
2023-01-12Feed the `features_query` instead of grabbing it from the session lazilyOli Scherer-0/+1
2023-01-12Remove `output_filenames` field from TyCtxt and feed the query insteadOli Scherer-1/+1