Rollup merge of #118574 - Enselic:query-instability, r=cjgillot

rustc_session: Address all `rustc::potential_query_instability` lints

Instead of allowing `rustc::potential_query_instability` on the whole crate we go over each lint and allow it individually if it is safe to do. Turns out all instances were safe to allow in this crate.

Part of #84447 which is **E-help-wanted**.
This commit is contained in:
Matthias Krüger 2023-12-03 21:28:32 +01:00 committed by GitHub
commit caeaf31316
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View File

@ -132,6 +132,8 @@ impl CodeStats {
pub fn print_type_sizes(&self) {
let type_sizes = self.type_sizes.borrow();
// We will soon sort, so the initial order does not matter.
#[allow(rustc::potential_query_instability)]
let mut sorted: Vec<_> = type_sizes.iter().collect();
// Primary sort: large-to-small.
@ -227,6 +229,8 @@ impl CodeStats {
}
pub fn print_vtable_sizes(&self, crate_name: Symbol) {
// We will soon sort, so the initial order does not matter.
#[allow(rustc::potential_query_instability)]
let mut infos =
std::mem::take(&mut *self.vtable_sizes.lock()).into_values().collect::<Vec<_>>();

View File

@ -6,7 +6,6 @@
#![feature(map_many_mut)]
#![feature(iter_intersperse)]
#![recursion_limit = "256"]
#![allow(rustc::potential_query_instability)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![allow(internal_features)]

View File

@ -51,6 +51,9 @@ impl GatedSpans {
/// Prepend the given set of `spans` onto the set in `self`.
pub fn merge(&self, mut spans: FxHashMap<Symbol, Vec<Span>>) {
let mut inner = self.spans.borrow_mut();
// The entries will be moved to another map so the drain order does not
// matter.
#[allow(rustc::potential_query_instability)]
for (gate, mut gate_spans) in inner.drain() {
spans.entry(gate).or_default().append(&mut gate_spans);
}