about summary refs log tree commit diff
path: root/compiler/rustc_macros/src/query.rs
AgeCommit message (Collapse)AuthorLines
2025-07-03Rollup merge of #134006 - klensy:typos, r=nnethercoteJana Dönszelmann-2/+2
setup typos check in CI This allows to check typos in CI, currently for compiler only (to reduce commit size with fixes). With current setup, exclude list is quite short, so it worth trying? Also includes commits with actual typo fixes. MCP: https://github.com/rust-lang/compiler-team/issues/817 typos check currently turned for: * ./compiler * ./library * ./src/bootstrap * ./src/librustdoc After merging, PRs which enables checks for other crates (tools) can be implemented too. Found typos will **not break** other jobs immediately: (tests, building compiler for perf run). Job will be marked as red on completion in ~ 20 secs, so you will not forget to fix it whenever you want, before merging pr. Check typos: `python x.py test tidy --extra-checks=spellcheck` Apply typo fixes: `python x.py test tidy --extra-checks=spellcheck:fix` (in case if there only 1 suggestion of each typo) Current fail in this pr is expected and shows how typo errors emitted. Commit with error will be removed after r+.
2025-07-03setup CI and tidy to use typos for spellchecking and fix few typosklensy-2/+2
2025-07-01Remove doc comments from TyCtxtFeedMichael Goulet-1/+0
2025-05-20Allow trailing comma after argument in query definitionMichael Goulet-0/+1
2025-05-17Enable rust-analyzer to go from query definition to the corresponding ↵Lukas Wirth-0/+14
provider field
2025-04-29Rename `rustc_query_append!` to `rustc_with_all_queries!`Zalathar-3/+15
2025-02-01Rename `ensure_forwards_result_if_red` to `return_result_from_ensure_ok`Zalathar-10/+16
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-2/+2
2024-08-29Add `warn(unreachable_pub)` to `rustc_macros`.Nicholas Nethercote-1/+1
2024-06-06Make the panic info more usefulOli Scherer-2/+19
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.