summary refs log tree commit diff
path: root/compiler/rustc_query_system/src/query
AgeCommit message (Collapse)AuthorLines
2022-10-14Remove the `describe` method from the `QueryDescription` traitnils-2/+0
It was called directly already, but now it's even more useless since it just forwards to the free function. Call it directly.
2022-10-07Rewrite representabilityCameron Steffen-9/+17
2022-09-21FIX - adopt new Diagnostic naming in newly migrated modulesJhonny Bill Mena-1/+1
FIX - ambiguous Diagnostic link in docs UPDATE - rename diagnostic_items to IntoDiagnostic and AddToDiagnostic [Gardening] FIX - formatting via `x fmt` FIX - rebase conflicts. NOTE: Confirm wheather or not we want to handle TargetDataLayoutErrorsWrapper this way DELETE - unneeded allow attributes in Handler method FIX - broken test FIX - Rebase conflict UPDATE - rename residual _SessionDiagnostic and fix LintDiag link
2022-09-21UPDATE - rename DiagnosticHandler trait to IntoDiagnosticJhonny Bill Mena-1/+1
2022-09-21UPDATE - move SessionDiagnostic from rustc_session to rustc_errorsJhonny Bill Mena-2/+4
2022-09-15correct span, add help message and add UI test when query depth overflowsSparrowLii-19/+3
2022-09-15add note for `layout_of` when query depth overflowsSparrowLii-3/+36
2022-09-09Remove unnecessary `TRY_LOAD_FROM_DISK` constantJoshua Nelson-4/+1
2022-09-09Remove `cache_on_disk` from `QueryVTable`Joshua Nelson-11/+5
This is not only simpler, but removes a generic function and unwrap. I have hope it will see compile time and bootstrap time improvements.
2022-09-08Auto merge of #101303 - jyn514:jnelson/handle-cycle-enum, r=cjgillotbors-5/+38
Make `HandleCycleError` an enum instead of a macro-generated closure Helps with https://github.com/rust-lang/rust/issues/96524. Based on https://github.com/rust-lang/rust/pull/100943 to avoid merge conflicts, so it looks larger than it is (only the last commit is relevant). cc https://rust-lang.zulipchat.com/#narrow/stream/241847-t-compiler.2Fwg-incr-comp/topic/Moving.20.60Value.60.20to.20rustc_query_system.20.2396524 r? `@cjgillot`
2022-09-06Make `HandleCycleError` an enum instead of a macro-generated closureJoshua Nelson-5/+38
- Add a `HandleCycleError` enum to rustc_query_system, along with a `handle_cycle_error` function - Move `Value` to rustc_query_system, so `handle_cycle_error` can use it - Move the `Value` impls from rustc_query_impl to rustc_middle. This is necessary due to orphan rules.
2022-09-05UPDATE - into_diagnostic to take a Handler instead of a ParseSessJhonny Bill Mena-1/+1
Suggested by the team in this Zulip Topic https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20SessionDiagnostic.20on.20Handler Handler already has almost all the capabilities of ParseSess when it comes to diagnostic emission, in this migration we only needed to add the ability to access source_map from the emitter in order to get a Snippet and the start_point. Not sure if this is the best way to address this gap
2022-09-01Don't create two new closures for each queryJoshua Nelson-0/+3
- Parameterize DepKindStruct over `'tcx` This allows passing in an invariant function pointer in `query_callback`, rather than having to try and make it work for any lifetime. - Add a new `execute_query` function to `QueryDescription` so we can call `tcx.$name` without needing to be in a macro context
2022-09-01Auto merge of #100869 - nnethercote:replace-ThinVec, r=spastorinobors-3/+2
Replace `rustc_data_structures::thin_vec::ThinVec` with `thin_vec::ThinVec` `rustc_data_structures::thin_vec::ThinVec` looks like this: ``` pub struct ThinVec<T>(Option<Box<Vec<T>>>); ``` It's just a zero word if the vector is empty, but requires two allocations if it is non-empty. So it's only usable in cases where the vector is empty most of the time. This commit removes it in favour of `thin_vec::ThinVec`, which is also word-sized, but stores the length and capacity in the same allocation as the elements. It's good in a wider variety of situation, e.g. in enum variants where the vector is usually/always non-empty. The commit also: - Sorts some `Cargo.toml` dependency lists, to make additions easier. - Sorts some `use` item lists, to make additions easier. - Changes `clean_trait_ref_with_bindings` to take a `ThinVec<TypeBinding>` rather than a `&[TypeBinding]`, because this avoid some unnecessary allocations. r? `@spastorino`
2022-08-31SessionDiagnostic for QueryOverflow errorLi Yuanheng-1/+1
2022-08-31delete leftover commentLi Yuanheng-1/+0
2022-08-31use derive proc macro to impl SessionDiagnosticYuanheng Li-13/+30
fixes `SessionSubdiagnostic` to accept multiple attributes emitting list of fluent message remains unresolved
2022-08-31migrate rustc_query_system to use SessionDiagnosticYuanheng Li-46/+23
with manual impl SessionDiagnostic
2022-08-29Replace `rustc_data_structures::thin_vec::ThinVec` with `thin_vec::ThinVec`.Nicholas Nethercote-3/+2
`rustc_data_structures::thin_vec::ThinVec` looks like this: ``` pub struct ThinVec<T>(Option<Box<Vec<T>>>); ``` It's just a zero word if the vector is empty, but requires two allocations if it is non-empty. So it's only usable in cases where the vector is empty most of the time. This commit removes it in favour of `thin_vec::ThinVec`, which is also word-sized, but stores the length and capacity in the same allocation as the elements. It's good in a wider variety of situation, e.g. in enum variants where the vector is usually/always non-empty. The commit also: - Sorts some `Cargo.toml` dependency lists, to make additions easier. - Sorts some `use` item lists, to make additions easier. - Changes `clean_trait_ref_with_bindings` to take a `ThinVec<TypeBinding>` rather than a `&[TypeBinding]`, because this avoid some unnecessary allocations.
2022-08-24add `depth_limit` in `QueryVTable`SparrowLii-13/+23
2022-07-29Remove useless closure.Camille GILLOT-5/+3
2022-07-28Remove guess_head_span.Camille GILLOT-6/+2
2022-07-20consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable)Ralf Jung-10/+10
2022-07-13Rename `debugging_opts` to `unstable_opts`Joshua Nelson-2/+2
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear.
2022-07-09Auto merge of #99028 - tmiasko:inline, r=estebankbors-0/+3
Miscellaneous inlining improvements Add `#[inline]` to a few trivial non-generic methods from a perf report that otherwise wouldn't be candidates for inlining.
2022-07-07Miscellaneous inlining improvementsTomasz Miąsko-0/+3
Add `#[inline]` to a few trivial non-generic methods from a perf report that otherwise wouldn't be candidates for inlining.
2022-07-06Allow to create definitions inside the query system.Camille GILLOT-2/+1
2022-06-29get rid of `tcx` in deadlock handler when parallel compilationSparrowLii-2/+1
2022-06-18Remove `likely!` and `unlikely!` macro from compilerGary Guo-7/+9
2022-05-04Enable tracing for all queryiesOli Scherer-1/+1
2022-04-05errors: implement fallback diagnostic translationDavid Wood-2/+2
This commit updates the signatures of all diagnostic functions to accept types that can be converted into a `DiagnosticMessage`. This enables existing diagnostic calls to continue to work as before and Fluent identifiers to be provided. The `SessionDiagnostic` derive just generates normal diagnostic calls, so these APIs had to be modified to accept Fluent identifiers. In addition, loading of the "fallback" Fluent bundle, which contains the built-in English messages, has been implemented. Each diagnostic now has "arguments" which correspond to variables in the Fluent messages (necessary to render a Fluent message) but no API for adding arguments has been added yet. Therefore, diagnostics (that do not require interpolation) can be converted to use Fluent identifiers and will be output as before.
2022-03-02rename ErrorReported -> ErrorGuaranteedmark-6/+8
2022-02-27Auto merge of #94084 - Mark-Simulacrum:drop-sharded, r=cjgillotbors-184/+149
Avoid query cache sharding code in single-threaded mode In non-parallel compilers, this is just adding needless overhead at compilation time (since there is only one shard statically anyway). This amounts to roughly ~10 seconds reduction in bootstrap time, with overall neutral (some wins, some losses) performance results. Parallel compiler performance should be largely unaffected by this PR; sharding is kept there.
2022-02-23rustc_errors: let `DiagnosticBuilder::emit` return a "guarantee of emission".Eduard-Mihai Burtescu-6/+6
2022-02-20Refactor Sharded out of non-parallel active query mapMark Rousskov-27/+51
2022-02-20Avoid sharding query caches entirely in single-threaded modeMark Rousskov-20/+59
2022-02-20Inline QueryStateShard into QueryStateMark Rousskov-17/+7
2022-02-20Delete QueryLookupMark Rousskov-34/+15
This was largely just caching the shard value at this point, which is not particularly useful -- in the use sites the key was being hashed nearby anyway.
2022-02-20Move Sharded maps into each QueryCache implMark Rousskov-113/+44
2022-02-17Remove SimpleDefKindMark Rousskov-36/+10
2022-02-08Switch QueryJobId to a single global counterMark Rousskov-163/+91
This replaces the per-shard counters with a single global counter, simplifying the JobId struct down to just a u64 and removing the need to pipe a DepKind generic through a bunch of code. The performance implications on non-parallel compilers are likely minimal (this switches to `Cell<u64>` as the backing storage over a `u64`, but the latter was already inside a `RefCell` so it's not really a significance divergence). On parallel compilers, the cost of a single global u64 counter may be more significant: it adds a serialization point in theory. On the other hand, we can imagine changing the counter to have a thread-local component if it becomes worrisome or some similar structure. The new design is sufficiently simpler that it warrants the potential for slight changes down the line if/when we get parallel compilation to be more of a default. A u64 counter, instead of u32 (the old per-shard width), is chosen to avoid possibly overflowing it and causing problems; it is effectively impossible that we would overflow a u64 counter in this context.
2022-01-08Auto merge of #91919 - Aaron1011:query-recursive-read, r=michaelwoeristerbors-2/+7
Don't perform any new queries while reading a query result on disk In addition to being very confusing, this can cause us to add dep node edges between two queries that would not otherwise have an edge. We now panic if any new dep node edges are created during the deserialization of a query result. This requires serializing the full `AdtDef` to disk, instead of just serializing the `DefId` and invoking the `adt_def` query during deserialization. I'll probably split this up into several smaller PRs for perf runs.
2021-12-23Address review commentsAaron Hill-8/+7
2021-12-23Some cleanupAaron Hill-5/+4
2021-12-23Ban deps only during query loading from diskAaron Hill-3/+9
2021-12-23Error if we try to read dep during deserializationAaron Hill-3/+4
2021-12-21Add `#[rustc_clean(loaded_from_disk)]` to assert loading of query resultAaron Hill-0/+4
Currently, you can use `#[rustc_clean]` to assert to that a particular query (technically, a `DepNode`) is green or red. However, a green `DepNode` does not mean that the query result was actually deserialized from disk - we might have never re-run a query that needed the result. Some incremental tests are written as regression tests for ICEs that occured during query result decoding. Using `#[rustc_clean(loaded_from_disk="typeck")]`, you can now assert that the result of a particular query (e.g. `typeck`) was actually loaded from disk, in addition to being green.
2021-11-22Manually outline error on incremental_verify_ichMark Rousskov-24/+73
This reduces codegen for rustc_query_impl by 169k lines of LLVM IR, representing a 1.2% improvement.
2021-10-28Enable verification for 1/32th of queries loaded from diskMark Rousskov-1/+14
2021-10-23Do not require QueryCtxt for cache_on_disk.Camille GILLOT-1/+1