44//! modifier names in the query list, and to allow find-all-references to list
55//! all queries that use a particular modifier.
66#![ allow( unused, non_camel_case_types) ]
7- // FIXME: Update and clarify documentation for these modifiers.
87
98// tidy-alphabetical-start
109//
1110/// # `anon` query modifier
1211///
13- /// Generate a dep node based on the dependencies of the query
12+ /// Generate a dep node based not on the query key, but on the query's dependencies.
1413pub ( crate ) struct anon ;
1514
1615/// # `arena_cache` query modifier
1716///
18- /// Use this type for the in-memory cache.
17+ /// Query return values must impl `Copy` and be small, but some queries must return values that
18+ /// doesn't meet those criteria. Queries marked with this modifier have their values allocated in
19+ /// an arena and the query returns a reference to the value. There are two cases.
20+ /// - If the provider function returns `T` then the query will return `&'tcx T`.
21+ /// - If the provider function returns `Option<T>` then the query will return `Option<&'tcx T>`.
22+ ///
23+ /// The query plumbing takes care of the arenas and the type manipulations.
1924pub ( crate ) struct arena_cache ;
2025
21- /// # `cache_on_disk_if` query modifier
26+ /// # `cache_on_disk_if { ... }` query modifier
27+ ///
28+ /// Cache the query result to disk if the provided block evaluates to true. The query key
29+ /// identifier is available for use within the block, as is `tcx`.
2230///
23- /// Cache the query to disk if the `Block` returns true.
31+ /// The decision to use this modifier comes down to whether it helps performance. Not all query
32+ /// results need to be saved to disk. In particular, caching values from upstream crates is
33+ /// pointless because they are already available in the upstream crate’s metadata.
2434pub ( crate ) struct cache_on_disk_if ;
2535
2636/// # `cycle_delay_bug` query modifier
2737///
28- /// A cycle error results in a delay_bug call
38+ /// If a dependency cycle is detected, emit a delayed bug instead of a normal error.
2939pub ( crate ) struct cycle_delay_bug ;
3040
3141/// # `cycle_stash` query modifier
3242///
33- /// A cycle error results in a stashed cycle error that can be unstashed and canceled later
43+ /// If a dependency cycle is detected, stash the error for later handling.
3444pub ( crate ) struct cycle_stash ;
3545
3646/// # `depth_limit` query modifier
3747///
38- /// Whether the query has a call depth limit
48+ /// Impose a recursion call depth limit on the query to prevent stack overflow.
3949pub ( crate ) struct depth_limit ;
4050
41- /// # `desc` query modifier
51+ /// # `desc { ... } ` query modifier
4252///
43- /// The description of the query. This modifier is required on every query.
53+ /// The human-readable description of the query, for diagnostics and profiling. Required for every
54+ /// query. The block should contain a `format!`-style string literal followed by optional
55+ /// arguments. The query key identifier is available for use within the block, as is `tcx`.
4456pub ( crate ) struct desc ;
4557
4658/// # `eval_always` query modifier
4759///
48- /// Always evaluate the query, ignoring its dependencies
60+ /// Queries with this modifier do not track their dependencies, and are treated as always having a
61+ /// red (dirty) dependency instead. This is necessary for queries that interact with state that
62+ /// isn't tracked by the query system.
63+ ///
64+ /// It can also improve performance for queries that are so likely to be dirtied by any change that
65+ /// it's not worth tracking their actual dependencies at all.
66+ ///
67+ /// As with all queries, the return value is still cached in memory for the rest of the compiler
68+ /// session.
4969pub ( crate ) struct eval_always ;
5070
5171/// # `feedable` query modifier
@@ -55,12 +75,12 @@ pub(crate) struct feedable;
5575
5676/// # `no_hash` query modifier
5777///
58- /// Don't hash the result, instead just mark a query red if it runs
78+ /// Do not hash the query result for incremental compilation; just mark it as dirty if recomputed.
5979pub ( crate ) struct no_hash ;
6080
6181/// # `separate_provide_extern` query modifier
6282///
63- /// Use a separate query provider for local and extern crates
83+ /// Use separate query provider functions for local and extern crates.
6484pub ( crate ) struct separate_provide_extern ;
6585
6686// tidy-alphabetical-end
0 commit comments