about summary refs log tree commit diff
path: root/compiler/rustc_macros/src/query.rs
AgeCommit message (Collapse)AuthorLines
2024-01-24Correctly explain `ensure_forwards_result_if_red`Oli Scherer-1/+2
2023-10-26Stash and cancel cycle errors for auto trait leakage in opaquesMichael Goulet-0/+8
2023-10-23Allow `ensure` queries to return `Result<(), ErrorGuaranteed>`Oli Scherer-0/+10
2023-05-18Merge query property modules into oneJohn Kåre Alsaker-3/+3
2023-05-15Move expansion of query macros in rustc_middle to rustc_middle::queryJohn Kåre Alsaker-3/+3
2023-04-08Remove `remap_env_constness` in queriesDeadbeef-8/+0
2023-04-06migrate rustc_macros to syn 2.0Deadbeef-4/+4
2023-01-05Fix `uninlined_format_args` for some compiler cratesnils-1/+1
Convert all the crates that have had their diagnostic migration completed (except save_analysis because that will be deleted soon and apfloat because of the licensing problem).
2022-12-05feed resolver_for_lowering instead of storing it in a fieldOli Scherer-4/+0
2022-11-29Sanity check computed value for feeable queries.Camille GILLOT-0/+9
2022-11-29Allow to set a query's result as a side effect.Camille GILLOT-1/+20
2022-10-14Get rid of `rustc_query_description!`Nilstrieb-17/+28
Queries can provide an arbitrary expression for their description and their caching behavior. Before, these expressions where stored in a `rustc_query_description` macro emitted by the `rustc_queries` macro, and then used in `rustc_query_impl` to fill out the methods for the `QueryDescription` trait. Instead, we now emit two new modules from `rustc_queries` containing the functions with the expressions. `rustc_query_impl` calls these functions now instead of invoking the macro. Since we are now defining some of the functions in `rustc_middle::query`, we now need all the imports for the key types there as well.
2022-10-14Remove unsued variable in query macroNilstrieb-7/+0
2022-09-15Auto merge of #101173 - jyn514:simplify-macro-arguments, r=cjgillotbors-22/+7
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-14Update compiler/rustc_macros/src/query.rsCamille Gillot-1/+1
2022-09-09Move `TRY_LOAD_FROM_DISK` out of `rustc_queries` to `rustc_query_impl`Joshua Nelson-5/+4
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-09Don't create a new `try_load_from_disk` closure for each queryJoshua Nelson-1/+1
Instead, define a single function, parameterized only by the return type.
2022-09-09Remove dead `load_cached` code in rustc_queryJoshua Nelson-33/+2
2022-09-09Simplify the implementation of `rustc_queries`Joshua Nelson-35/+18
2022-09-09Make the `storage` query modifier less generalJoshua Nelson-12/+8
In practice, it was only ever used with `ArenaCacheSelector`. Change it to a single boolean `arena_cache` rather than allowing queries to specify an arbitrary type.
2022-09-06Get rid of the emitted `rustc_query_names` and `rustc_cached_queries` macroJoshua Nelson-22/+7
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/+6
2022-09-06Further simplify the macros generated by `rustc_queries`Joshua Nelson-13/+9
- 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-08-27Auto merge of #100946 - jyn514:query-system-3, r=cjgillotbors-11/+11
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/+12
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-24Remove the `$tcx:tt` parameter from `rustc_query_description`Joshua Nelson-5/+5
It's unnecessary.
2022-08-24Simplify the syntax for macros generated by `rustc_queries`Joshua Nelson-6/+6
- 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-23Remove `$tcx` metavariable from `rustc_query_append`Joshua Nelson-3/+1
It's not actually necessary and it makes the code harder to read.
2022-08-24add `depth_limit` in `QueryVTable`SparrowLii-1/+12
2022-08-21Refactor query modifier parsingCameron Steffen-260/+125
2022-02-16Move ty::print methods to Drop-based scope guardsMark Rousskov-1/+3
2021-12-12Query modifierDeadbeef-0/+20
2021-10-25Avoid a branch on key being local for queries that use the same local and ↵bjorn3-0/+23
extern providers
2021-10-23Do not require QueryCtxt for cache_on_disk.Camille GILLOT-2/+2
2021-10-23Build the query vtable directly.Camille GILLOT-24/+18
2021-10-21Do not depend on the stored value when trying to cache on disk.Camille GILLOT-14/+4
2021-10-02Prevent macro ambiguity errorsbjorn3-6/+6
The previous macro_rules! parsers failed when an additional modifier was added with ambiguity errors. The error is pretty unclear as to what exactly the cause here is, but this change simplifies the argument parsing code such that the error is avoided.
2021-08-19Rollup merge of #86123 - Aaron1011:query-span, r=cjgillotGuillaume Gomez-48/+56
Preserve more spans in internal `rustc_queries!` macro We now preserve the span of the various query modifiers, and use the span of the query's name for the commas that we generate to separate the modifiers. This makes debugging issues with the internal query macro infrastructure much nicer - previously, we would get errors messages pointing at the entire call site (the `rustc_queries!` invocation), which isn't very useful. This should have no effect when compilation succeeds. A concrete example of an error message produced after this changed: ``` error: local ambiguity: multiple parsing options: built-in NTs tt ('modifiers') or 1 other option. --> /home/aaron/repos/rust/compiler/rustc_middle/src/query/mod.rs:23:11 | 12 | / rustc_queries! { 13 | | query trigger_delay_span_bug(key: DefId) -> () { 14 | | desc { "trigger a delay span bug" } 15 | | } ... | 23 | | query hir_crate(key: ()) -> &'tcx Crate<'tcx> { | | ^^^^^^^^^ ... | 1715 | | } 1716 | | } | |_- in this expansion of `rustc_query_append!` | ::: compiler/rustc_query_impl/src/lib.rs:51:1 | 51 | rustc_query_append! { [define_queries!][<'tcx>] } | ------------------------------------------------- in this macro invocation ``` The particular bug shown in this error message will be fixed in a separate PR.
2021-07-18Move OnDiskCache to rustc_query_impl.Camille GILLOT-1/+1
2021-06-07Preserve more spans in internal `rustc_queries!` macroAaron Hill-48/+56
We now preserve the span of the various query modifiers, and use the span of the query's name for the commas that we generate to separate the modifiers. This makes debugging issues with the internal query macro infrastructure much nicer - previously, we would get errors messages pointing at the entire call site (the `rustc_queries!` invocation), which isn't very useful. This should have no effect when compilation succeeds. A concrete example of an error message produced after this changed: ``` error: local ambiguity: multiple parsing options: built-in NTs tt ('modifiers') or 1 other option. --> /home/aaron/repos/rust/compiler/rustc_middle/src/query/mod.rs:23:11 | 12 | / rustc_queries! { 13 | | query trigger_delay_span_bug(key: DefId) -> () { 14 | | desc { "trigger a delay span bug" } 15 | | } ... | 23 | | query hir_crate(key: ()) -> &'tcx Crate<'tcx> { | | ^^^^^^^^^ ... | 1715 | | } 1716 | | } | |_- in this expansion of `rustc_query_append!` | ::: compiler/rustc_query_impl/src/lib.rs:51:1 | 51 | rustc_query_append! { [define_queries!][<'tcx>] } | ------------------------------------------------- in this macro invocation ``` The particular bug shown in this error message will be fixed in a separate PR.
2021-02-24replaced some map_or with map_or_elseklensy-1/+1
2021-02-23replaced some unwrap_or with unwrap_or_elseklensy-2/+2
2021-02-19Move the query system to rustc_query_impl.Camille GILLOT-0/+3
2021-02-19Wrap QueryDescription into a macro.Camille GILLOT-4/+4
2021-02-19Make QueryEngine opaque to TyCtxt.Camille GILLOT-7/+5
2021-02-19Wrap TyCtxt inside a QueryCtxt for queries.Camille GILLOT-13/+13
2021-02-19Decouple the on-disk cache from the query engine.Camille GILLOT-2/+2
2021-02-08Switch query descriptions to just StringMark Rousskov-2/+2
In practice we never used the borrowed variant anyway.
2021-01-31Indent the code correctly again after removing the query categories.Julian Wollersberger-54/+52
2021-01-31Remove the remains of the query categories.Julian Wollersberger-23/+4