Skip to main content

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/// # `anon` query modifier
11///
12/// Generate a dep node based not on the query key, but on the query's dependencies.
13pub(crate) struct anon;
14
15/// # `arena_cache` query modifier
16///
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.
24pub(crate) struct arena_cache;
25
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`.
30pub(crate) struct cache_on_disk_if;
31
32/// # `depth_limit` query modifier
33///
34/// Impose a recursion call depth limit on the query to prevent stack overflow.
35pub(crate) struct depth_limit;
36
37/// # `desc { ... }` query modifier
38///
39/// The human-readable description of the query, for diagnostics and profiling. Required for every
40/// query. The block should contain a `format!`-style string literal followed by optional
41/// arguments. The query key identifier is available for use within the block, as is `tcx`.
42pub(crate) struct desc;
43
44/// # `eval_always` query modifier
45///
46/// Queries with this modifier do not track their dependencies, and are treated as always having a
47/// red (dirty) dependency instead. This is necessary for queries that interact with state that
48/// isn't tracked by the query system.
49///
50/// It can also improve performance for queries that are so likely to be dirtied by any change that
51/// it's not worth tracking their actual dependencies at all.
52///
53/// As with all queries, the return value is still cached in memory for the rest of the compiler
54/// session.
55pub(crate) struct eval_always;
56
57/// # `feedable` query modifier
58///
59/// Generate a `feed` method to set the query's value from another query.
60pub(crate) struct feedable;
61
62/// # `no_hash` query modifier
63///
64/// Do not hash the query's return value for incremental compilation. If the value needs to be
65/// recomputed, always mark its node as red (dirty).
66pub(crate) struct no_hash;
67
68/// # `separate_provide_extern` query modifier
69///
70/// Use separate query provider functions for local and extern crates.
71pub(crate) struct separate_provide_extern;
72
73// tidy-alphabetical-end