rustc_middle/query/modifiers.rs
1//! This contains documentation which is linked from query modifiers used in the `rustc_queries!` proc macro.
2//!
3//! The dummy items in this module are used to enable hover documentation for
4//! modifier names in the query list, and to allow find-all-references to list
5//! all queries that use a particular modifier.
6#![allow(unused, non_camel_case_types)]
7
8// tidy-alphabetical-start
9//
10/// # `arena_cache` query modifier
11///
12/// Query return values must impl `Copy` and be small, but some queries must return values that
13/// doesn't meet those criteria. Queries marked with this modifier have their values allocated in
14/// an arena and the query returns a reference to the value. There are two cases.
15/// - If the provider function returns `T` then the query will return `&'tcx T`.
16/// - If the provider function returns `Option<T>` then the query will return `Option<&'tcx T>`.
17///
18/// The query plumbing takes care of the arenas and the type manipulations.
19pub(crate) struct arena_cache;
20
21/// # `cache_on_disk_if { ... }` query modifier
22///
23/// Cache the query result to disk if the provided block evaluates to true. The query key
24/// identifier is available for use within the block, as is `tcx`.
25pub(crate) struct cache_on_disk_if;
26
27/// # `depth_limit` query modifier
28///
29/// Impose a recursion call depth limit on the query to prevent stack overflow.
30pub(crate) struct depth_limit;
31
32/// # `desc { ... }` query modifier
33///
34/// The human-readable description of the query, for diagnostics and profiling. Required for every
35/// query. The block should contain a `format!`-style string literal followed by optional
36/// arguments. The query key identifier is available for use within the block, as is `tcx`.
37pub(crate) struct desc;
38
39/// # `eval_always` query modifier
40///
41/// Queries with this modifier do not track their dependencies, and are treated as always having a
42/// red (dirty) dependency instead. This is necessary for queries that interact with state that
43/// isn't tracked by the query system.
44///
45/// It can also improve performance for queries that are so likely to be dirtied by any change that
46/// it's not worth tracking their actual dependencies at all.
47///
48/// As with all queries, the return value is still cached in memory for the rest of the compiler
49/// session.
50pub(crate) struct eval_always;
51
52/// # `feedable` query modifier
53///
54/// Generate a `feed` method to set the query's value from another query.
55pub(crate) struct feedable;
56
57/// # `no_force` query modifier
58///
59/// Dep nodes of queries with this modifier will never be "forced" when trying
60/// to mark their dependents green, even if their key is recoverable from the
61/// key fingerprint.
62///
63/// Used by some queries with custom cycle-handlers to ensure that if a cycle
64/// occurs, all of the relevant query calls will be on the query stack.
65pub(crate) struct no_force;
66
67/// # `no_hash` query modifier
68///
69/// Do not hash the query's return value for incremental compilation. If the value needs to be
70/// recomputed, always mark its node as red (dirty).
71pub(crate) struct no_hash;
72
73/// # `separate_provide_extern` query modifier
74///
75/// Use separate query provider functions for local and extern crates.
76pub(crate) struct separate_provide_extern;
77
78// tidy-alphabetical-end