Skip to content

Commit

Permalink
Rollup merge of #118574 - Enselic:query-instability, r=cjgillot
Browse files Browse the repository at this point in the history
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**.
  • Loading branch information
matthiaskrgr authored Dec 3, 2023
2 parents 80c94e8 + d87460a commit caeaf31
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions compiler/rustc_session/src/code_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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<_>>();

Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_session/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_session/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit caeaf31

Please sign in to comment.