about summary refs log tree commit diff
path: root/compiler/rustc_query_impl
AgeCommit message (Collapse)AuthorLines
2022-09-09Remove `cache_on_disk` from `QueryVTable`Joshua Nelson-2/+1
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-09Don't create a new `try_load_from_disk` closure for each queryJoshua Nelson-1/+26
Instead, define a single function, parameterized only by the return type.
2022-09-06Get rid of the emitted `rustc_query_names` and `rustc_cached_queries` macroJoshua Nelson-9/+21
We can avoid these by adding slightly more information to `rustc_query_append` instead.
2022-09-06Support doc-comments in `define_dep_nodes`Joshua Nelson-2/+2
2022-09-06Further simplify the macros generated by `rustc_queries`Joshua Nelson-2/+2
- Add a new `rustc_query_names` macro. This allows a much simpler syntax for the matchers in the macros passed to it as a callback. - Convert `define_dep_nodes` and `alloc_once` to use `rustc_query_names`. This is possible because they only use the names (despite the quite complicated matchers in `define_dep_nodes`, none of the other arguments are used). - Get rid of `rustc_dep_node_append`.
2022-09-06Move `Queries::new` out of the macroJoshua Nelson-15/+20
2022-09-06Make `HandleCycleError` an enum instead of a macro-generated closureJoshua Nelson-81/+11
- 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-01Don't create two new closures for each queryJoshua Nelson-30/+21
- 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-01Simplify `try_load_from_on_disk_cache`Joshua Nelson-8/+9
2022-09-01Move almost all of the function in `query_callbacks` to a generic functionJoshua Nelson-28/+47
2022-09-01Get rid of `fn recover`Joshua Nelson-18/+8
2022-09-01Move `force_with_dep_node` outside the giant macroJoshua Nelson-16/+26
2022-09-01Move `try_on_disk_cache` out of the giant macroJoshua Nelson-11/+19
2022-09-01Get rid of `make_query` moduleJoshua Nelson-13/+6
2022-09-01tracing::instrument cleanupOli Scherer-1/+1
2022-08-29Replace `rustc_data_structures::thin_vec::ThinVec` with `thin_vec::ThinVec`.Nicholas Nethercote-7/+6
`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-27Auto merge of #100946 - jyn514:query-system-3, r=cjgillotbors-3/+3
Simplify the arguments to macros generated by the `rustc_queries` proc macro Very small cleanup. Based on https://github.com/rust-lang/rust/pull/100436 which modifies some of the same code. r? `@cjgillot`
2022-08-25Auto merge of #100748 - SparrowLii:query_depth, r=cjgillotbors-1/+19
add `depth_limit` in `QueryVTable` to avoid entering a new tcx in `layout_of` Fixes #49735 Updates #48685 The `layout_of` query needs to check whether it overflows the depth limit, and the current implementation needs to create a new `ImplicitCtxt` inside `layout_of`. However, `start_query` will already create a new `ImplicitCtxt`, so we can check the depth limit in `start_query`. We can tell whether we need to check the depth limit simply by whether the return value of `to_debug_str` of the query is `layout_of`. But I think adding the `depth_limit` field in `QueryVTable` may be more elegant and more scalable.
2022-08-25Auto merge of #100436 - jyn514:macro-query-system, r=cjgillotbors-80/+89
try and simplify some things in the query system
2022-08-24Remove the `$tcx:tt` parameter from `rustc_query_description`Joshua Nelson-1/+1
It's unnecessary.
2022-08-24Simplify the syntax for macros generated by `rustc_queries`Joshua Nelson-2/+2
- Disallow multiple macros callbacks in the same invocation. In practice, this was never used. - Remove the `[]` brackets around the macro name - Require an `ident`, not an arbitrary `tt`
2022-08-23Move most of `make_query` into a generic function, away from the macroJoshua Nelson-42/+56
This should both make the code easier to read and also greatly reduce the amount of codegen the compiler has to do, since it only needs to monomorphize `create_query_frame` for each new key and not for each query.
2022-08-23Get rid of some usages of `query_keys`Joshua Nelson-7/+6
Rustdoc documents these with the name of the type alias instead of normalizing them to the underlying type. Use associated types instead so that the generated docs for nightly-rustc are easier to read.
2022-08-23Remove `$tcx` metavariable from `rustc_query_append`Joshua Nelson-34/+30
It's not actually necessary and it makes the code harder to read.
2022-08-24add `depth_limit` in `QueryVTable`SparrowLii-1/+19
2022-08-20rmeta/query cache: don't write string values of preinterned symbolsklensy-11/+23
2022-08-20Rollup merge of #100723 - 5225225:the-easy-ones, r=compiler-errorsMatthias Krüger-0/+2
Add the diagnostic translation lints to crates that don't emit them Some of these have a note saying that they should build on a stable compiler, does that mean they shouldn't get these lints? Or can we cfg them out on those?
2022-08-18Auto merge of #98851 - klensy:encode_symbols, r=cjgillotbors-1/+57
rustc_metadata: dedupe strings to prevent multiple copies in rmeta/query cache blow file size r? `@cjgillot` Encodes strings in rmeta/query cache so duplicated ones will be encoded as offsets to first strings, reducing file size.
2022-08-18Add diagnostic translation lints to crates that don't emit them5225225-0/+2
2022-08-17Rollup merge of #100389 - compiler-errors:return-type-suggestion-cycle, ↵Matthias Krüger-0/+21
r=cjgillot Do not report cycle error when inferring return type for suggestion The UI test is a good example of a case where this happens. The cycle is due to needing the value of the return type `-> _` to compute the variances of items in the crate, but then needing the variances of the items in the crate to do typechecking to infer what `-> _`'s real type is. Since we're already gonna emit an error in astconv, just delay the cycle bug as an error.
2022-08-16Do not report cycle error when inferring return type for suggestionMichael Goulet-0/+21
2022-08-15Remove usages of opt_remap_env_constnessMiguel Guarniz-3/+0
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-08-15Remove opt_remap_env_constness from rustc_query_implMiguel Guarniz-11/+1
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-08-15cache strings while encoding/decoding to compiler artifactsklensy-1/+57
2022-07-30Use LocalDefId for closures moreCameron Steffen-0/+10
2022-07-20consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable)Ralf Jung-3/+3
2022-07-14Use constant eval to do strict validity checks5225225-1/+11
2022-07-12Move abstract const to rustc_middle::tykadmin-2/+1
2022-07-06Use a dedicated DepKind for the forever-red node.Camille GILLOT-0/+11
2022-07-06Create a forever red node and use it to force side effects.Camille GILLOT-11/+0
2022-07-06Allow to create definitions inside the query system.Camille GILLOT-10/+21
2022-07-06Rollup merge of #98881 - cjgillot:q-def-kind, r=fee1-deadDylan DPC-5/+8
Only compute DefKind through the query.
2022-07-05Clarify the behaviour from inside the query system.Camille GILLOT-5/+8
2022-07-04Only compute DefKind through the query.Camille GILLOT-1/+1
2022-06-29get rid of `tcx` in deadlock handler when parallel compilationSparrowLii-5/+2
2022-06-17Auto merge of #98106 - cjgillot:split-definitions, r=michaelwoeristerbors-3/+2
Split up `Definitions` and `ResolverAstLowering`. Split off https://github.com/rust-lang/rust/pull/95573 r? `@michaelwoerister`
2022-06-16Move `finish` out of the `Encoder` trait.Nicholas Nethercote-68/+27
This simplifies things, but requires making `CacheEncoder` non-generic. (This was previously merged as commit 4 in #94732 and then was reverted in #97905 because it caused a perf regression.)
2022-06-15Rollup merge of #98083 - nnethercote:rename-Encoder, r=bjorn3Yuki Okushi-6/+6
Rename rustc_serialize::opaque::Encoder as MemEncoder. This avoids the name clash with `rustc_serialize::Encoder` (a trait), and allows lots qualifiers to be removed and imports to be simplified (e.g. fewer `as` imports). (This was previously merged as commit 5 in #94732 and then was reverted in #97905 because of a perf regression caused by commit 4 in #94732.) r? ```@bjorn3```
2022-06-15Rollup merge of #98067 - klensy:compiler-deps2, r=Dylan-DPCYuki Okushi-1/+0
compiler: remove unused deps Removed unused dependencies in compiler crates and moves few `libc` under `target.cfg(unix)` .
2022-06-14Separate `source_span` and `expn_that_defined` from `Definitions`.Camille GILLOT-3/+2