Skip to content

Commit 2acf7eb

Browse files
authored
Unrolled build for rust-lang#117327
Rollup merge of rust-lang#117327 - Nilstrieb:more-query-docs, r=compiler-errors Add documentation for some queries
2 parents 8534923 + 5e32da5 commit 2acf7eb

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

compiler/rustc_middle/src/query/mod.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,12 @@ pub use plumbing::{IntoQueryParam, TyCtxtAt, TyCtxtEnsure, TyCtxtEnsureWithValue
109109
// Queries marked with `fatal_cycle` do not need the latter implementation,
110110
// as they will raise an fatal error on query cycles instead.
111111
rustc_queries! {
112+
/// This exists purely for testing the interactions between delay_span_bug and incremental.
112113
query trigger_delay_span_bug(key: DefId) -> () {
113-
desc { "triggering a delay span bug" }
114+
desc { "triggering a delay span bug for testing incremental" }
114115
}
115116

117+
/// Collects the list of all tools registered using `#![register_tool]`.
116118
query registered_tools(_: ()) -> &'tcx ty::RegisteredTools {
117119
arena_cache
118120
desc { "compute registered tools for crate" }
@@ -286,6 +288,7 @@ rustc_queries! {
286288
}
287289
}
288290

291+
/// The root query triggering all analysis passes like typeck or borrowck.
289292
query analysis(key: ()) -> Result<(), ErrorGuaranteed> {
290293
eval_always
291294
desc { "running analysis passes on this crate" }
@@ -1778,10 +1781,17 @@ rustc_queries! {
17781781
desc { "calculating the missing lang items in a crate" }
17791782
separate_provide_extern
17801783
}
1784+
1785+
/// The visible parent map is a map from every item to a visible parent.
1786+
/// It prefers the shortest visible path to an item.
1787+
/// Used for diagnostics, for example path trimming.
1788+
/// The parents are modules, enums or traits.
17811789
query visible_parent_map(_: ()) -> &'tcx DefIdMap<DefId> {
17821790
arena_cache
17831791
desc { "calculating the visible parent map" }
17841792
}
1793+
/// Collects the "trimmed", shortest accessible paths to all items for diagnostics.
1794+
/// See the [provider docs](`rustc_middle::ty::print::trimmed_def_paths`) for more info.
17851795
query trimmed_def_paths(_: ()) -> &'tcx FxHashMap<DefId, Symbol> {
17861796
arena_cache
17871797
desc { "calculating trimmed def paths" }

compiler/rustc_middle/src/ty/print/pretty.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3018,7 +3018,8 @@ fn for_each_def(tcx: TyCtxt<'_>, mut collect_fn: impl for<'b> FnMut(&'b Ident, N
30183018
/// The implementation uses similar import discovery logic to that of 'use' suggestions.
30193019
///
30203020
/// See also [`DelayDm`](rustc_error_messages::DelayDm) and [`with_no_trimmed_paths!`].
3021-
fn trimmed_def_paths(tcx: TyCtxt<'_>, (): ()) -> FxHashMap<DefId, Symbol> {
3021+
// this is pub to be able to intra-doc-link it
3022+
pub fn trimmed_def_paths(tcx: TyCtxt<'_>, (): ()) -> FxHashMap<DefId, Symbol> {
30223023
let mut map: FxHashMap<DefId, Symbol> = FxHashMap::default();
30233024

30243025
if let TrimmedDefPaths::GoodPath = tcx.sess.opts.trimmed_def_paths {

tests/ui/treat-err-as-bug/delay_span_bug.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// compile-flags: -Ztreat-err-as-bug
22
// failure-status: 101
33
// error-pattern: aborting due to `-Z treat-err-as-bug=1`
4-
// error-pattern: [trigger_delay_span_bug] triggering a delay span bug
4+
// error-pattern: [trigger_delay_span_bug] triggering a delay span bug for testing incremental
55
// normalize-stderr-test "note: .*\n\n" -> ""
66
// normalize-stderr-test "thread 'rustc' panicked.*:\n.*\n" -> ""
77
// rustc-env:RUST_BACKTRACE=0

tests/ui/treat-err-as-bug/delay_span_bug.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ LL | fn main() {}
77
error: the compiler unexpectedly panicked. this is a bug.
88

99
query stack during panic:
10-
#0 [trigger_delay_span_bug] triggering a delay span bug
10+
#0 [trigger_delay_span_bug] triggering a delay span bug for testing incremental
1111
end of query stack

0 commit comments

Comments
 (0)