about summary refs log tree commit diff
path: root/compiler/rustc_query_impl
AgeCommit message (Collapse)AuthorLines
2022-09-26Auto merge of #101785 - jyn514:query-struct-fn-ptrs, r=cjgillotbors-56/+95
Use function pointers instead of macro-unrolled loops in rustc_query_impl By making these standalone functions, we a) allow making them extensible in the future with a new `QueryStruct` b) greatly decrease the amount of code in each individual function, avoiding exponential blowup in llvm Helps with https://github.com/rust-lang/rust/issues/96524. Based on https://github.com/rust-lang/rust/pull/101173; only the last commit is relevant. r? `@cjgillot`
2022-09-25Move the `codegen_unit` debug assert from `rustc_query_system` to `query_impl`Joshua Nelson-0/+18
This allows removing a function from the `DepKind` trait.
2022-09-25Use function pointers instead of macro-unrolled loops in rustc_query_implJoshua Nelson-56/+95
By making these standalone functions, we a) allow making them extensible in the future with a new `QueryStruct` b) greatly decrease the amount of code in each individual function, avoiding exponential blowup in llvm
2022-09-24separate definitions and `HIR` ownersTakayuki Maeda-0/+14
fix a ui test use `into` fix clippy ui test fix a run-make-fulldeps test implement `IntoQueryParam<DefId>` for `OwnerId` use `OwnerId` for more queries change the type of `ParentOwnerIterator::Item` to `(OwnerId, OwnerNode)`
2022-09-24Auto merge of #102064 - cjgillot:revert, r=Mark-Simulacrumbors-17/+0
Revert perf-regression 101620 Reverts #101862 #101620 r? `@Mark-Simulacrum`
2022-09-23rename Unevaluated to UnevaluatedConstb-naber-1/+1
2022-09-22Revert "Auto merge of #101620 - cjgillot:compute_lint_levels_by_def, r=oli-obk"Camille GILLOT-17/+0
This reverts commit 2cb9a65684dba47c52de8fa938febf97a73e70a9, reversing changes made to 750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c.
2022-09-22introduce mir::Unevaluatedb-naber-1/+1
2022-09-17Rollup merge of #101801 - SparrowLii:query_depth_note, r=estebankMatthias Krüger-2/+27
add note for `layout_of` when query depth overflows Fixes #101747 Added `try_find_layout_root` function to add a note for `layout_of` when query depth overflows. This would make the error in #101747 look like this: ``` error: queries overflow the depth limit! | note: Query depth increased by 66 when computing layout of `core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<alloc::boxed::Box<alloc::string::String>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`! --> D:\rust-backup\parallel_rust\query_depth.rs:40:1 | 40 | fn main() { | ^^^^^^^^^ error: aborting due to previous error ``` cc ``@semicoleon``
2022-09-16Rollup merge of #101787 - compiler-errors:cache-rpitit, r=petrochenkovDylan DPC-0/+6
cache `collect_trait_impl_trait_tys` Micro-optimization for RPITITs
2022-09-15Auto merge of #101173 - jyn514:simplify-macro-arguments, r=cjgillotbors-8/+20
Further simplify the macros generated by `rustc_queries` This doesn't actually move anything outside the macros, but it makes them simpler to read. - 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`. r? `@cjgillot`
2022-09-15correct span, add help message and add UI test when query depth overflowsSparrowLii-1/+26
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.