@@ -175,8 +175,8 @@ Defining a query takes place in two steps:
175
175
To declare the query name and arguments, you simply add an entry to
176
176
the big macro invocation in [ ` compiler/rustc_middle/src/query/mod.rs ` ] [ query-mod ] .
177
177
Then you need to add a documentation comment to it with some _ internal_ description.
178
- Then, provide the ` desc ` attribute which contains a short description of the query.
179
- This description is shown to the user in query cycles.
178
+ Then, provide the ` desc ` attribute which contains a _ user-facing _ description of the query.
179
+ The ` desc ` attribute is shown to the user in query cycles.
180
180
181
181
This looks something like:
182
182
@@ -237,35 +237,6 @@ which is used to cheaply modify MIR in place. See the definition
237
237
of ` Steal ` for more details. New uses of ` Steal ` should ** not** be
238
238
added without alerting ` @rust-lang/compiler ` .
239
239
240
- ### Query structs and descriptions
241
-
242
- For each query, the ` rustc_queries ` macro will generate a "query struct"
243
- named after the query. This struct is a kind of placeholder
244
- describing the query. Each query struct implements the
245
- [ ` self::config::QueryConfig ` ] [ QueryConfig ] trait, which has associated types for the
246
- key/value of that particular query. Basically the code generated looks something
247
- like this:
248
-
249
- ``` rust,ignore
250
- // Dummy struct representing a particular kind of query:
251
- pub struct type_of<'tcx> { data: PhantomData<&'tcx ()> }
252
-
253
- impl<'tcx> QueryConfig for type_of<'tcx> {
254
- type Key = DefId;
255
- type Value = Ty<'tcx>;
256
-
257
- const NAME: QueryName = QueryName::type_of;
258
- const CATEGORY: ProfileCategory = ProfileCategory::Other;
259
- }
260
- ```
261
-
262
- There is an additional trait with more methods called
263
- [ ` self::config::QueryDescription ` ] [ QueryDescription ] . This trait contains a few
264
- extra methods which are used by the query system.
265
-
266
- [ QueryConfig ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_query_system/query/config/trait.QueryConfig.html
267
- [ QueryDescription ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_query_system/query/config/trait.QueryDescription.html
268
-
269
240
## External links
270
241
271
242
Related design ideas, and tracking issues:
0 commit comments