Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e9b16cc

Browse files
committedDec 12, 2023
rustc_passes: Enforce rustc::potential_query_instability lint
Stop allowing `rustc::potential_query_instability` in all of `rustc_passes` and instead allow it on a case-by-case basis if it is safe. In this case, all instances of the lint are safe to allow.
1 parent 5b8bc56 commit e9b16cc

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed
 

‎compiler/rustc_passes/src/diagnostic_items.rs

+3
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ fn all_diagnostic_items(tcx: TyCtxt<'_>, (): ()) -> DiagnosticItems {
8383

8484
// Collect diagnostic items in other crates.
8585
for &cnum in tcx.crates(()).iter().chain(std::iter::once(&LOCAL_CRATE)) {
86+
// We are collecting many DiagnosticItems hash maps into one
87+
// DiagnosticItems hash map. The iteration order does not matter.
88+
#[allow(rustc::potential_query_instability)]
8689
for (&name, &def_id) in &tcx.diagnostic_items(cnum).name_to_id {
8790
collect_item(tcx, &mut items, name, def_id);
8891
}

‎compiler/rustc_passes/src/hir_stats.rs

+4
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ impl<'k> StatCollector<'k> {
121121
}
122122

123123
fn print(&self, title: &str, prefix: &str) {
124+
// We will soon sort, so the initial order does not matter.
125+
#[allow(rustc::potential_query_instability)]
124126
let mut nodes: Vec<_> = self.nodes.iter().collect();
125127
nodes.sort_by_key(|(_, node)| node.stats.count * node.stats.size);
126128

@@ -147,6 +149,8 @@ impl<'k> StatCollector<'k> {
147149
to_readable_str(node.stats.size)
148150
);
149151
if !node.subnodes.is_empty() {
152+
// We will soon sort, so the initial order does not matter.
153+
#[allow(rustc::potential_query_instability)]
150154
let mut subnodes: Vec<_> = node.subnodes.iter().collect();
151155
subnodes.sort_by_key(|(_, subnode)| subnode.count * subnode.size);
152156

‎compiler/rustc_passes/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
//!
55
//! This API is completely unstable and subject to change.
66
7-
#![allow(rustc::potential_query_instability)]
87
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
98
#![doc(rust_logo)]
109
#![feature(rustdoc_internals)]

‎compiler/rustc_passes/src/stability.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,9 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
10481048
tcx.sess.emit_err(errors::UnknownFeature { span, feature: *feature });
10491049
}
10501050

1051+
// We only use the hash map contents to emit errors, and the order of
1052+
// emitted errors do not affect query stability.
1053+
#[allow(rustc::potential_query_instability)]
10511054
for (implied_by, feature) in remaining_implications {
10521055
let local_defined_features = tcx.lib_features(LOCAL_CRATE);
10531056
let span = local_defined_features

0 commit comments

Comments
 (0)
Failed to load comments.