about summary refs log tree commit diff
path: root/compiler/rustc_query_impl
AgeCommit message (Collapse)AuthorLines
2022-09-15add note for `layout_of` when query depth overflowsSparrowLii-1/+1
2022-09-14cache collect_trait_impl_trait_tysMichael Goulet-0/+6
2022-09-14Correct Key impl for HirId.Camille GILLOT-2/+2
2022-09-14Compute `lint_levels` by definitionDeadbeef-0/+17
2022-09-14Auto merge of #101307 - jyn514:simplify-storage, r=cjgillotbors-3/+26
Simplify caching and storage for queries I highly recommend reviewing commit-by-commit; each individual commit is quite small but it can be hard to see looking at the overall diff that the behavior is the same. Each commit depends on the previous. r? `@cjgillot`
2022-09-10Rollup merge of #101635 - jyn514:queries-new-derived, r=cjgillotDylan DPC-15/+20
Move `Queries::new` out of the macro Split out from https://github.com/rust-lang/rust/pull/101178 to make sure it's not contributing to the perf impact. r? `@cjgillot`
2022-09-09Remove unnecessary `TRY_LOAD_FROM_DISK` constantJoshua Nelson-5/+1
2022-09-09Move `TRY_LOAD_FROM_DISK` out of `rustc_queries` to `rustc_query_impl`Joshua Nelson-0/+3
We want to refer to `crate::plumbing::try_load_from_disk` in the const, but hard-coding it in rustc_queries, where we don't yet know the crate this macro will be called in, seems kind of hacky. Do it in query_impl instead.
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.