Skip to content

Commit 85159a4

Browse files
authored
Rollup merge of rust-lang#99126 - NiklasJonsson:84447/rustc_span, r=petrochenkov
remove allow(rustc::potential_query_instability) in rustc_span Also, avoid sorting before debug output as iteration order can now be relied upon. Related rust-lang#84447
2 parents e5a86d7 + f94484f commit 85159a4

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

compiler/rustc_span/src/hygiene.rs

+6
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,10 @@ pub fn debug_hygiene_data(verbose: bool) -> String {
644644
let expn_data = expn_data.as_ref().expect("no expansion data for an expansion ID");
645645
debug_expn_data((&id.to_expn_id(), expn_data))
646646
});
647+
647648
// Sort the hash map for more reproducible output.
649+
// Because of this, it is fine to rely on the unstable iteration order of the map.
650+
#[allow(rustc::potential_query_instability)]
648651
let mut foreign_expn_data: Vec<_> = data.foreign_expn_data.iter().collect();
649652
foreign_expn_data.sort_by_key(|(id, _)| (id.krate, id.local_id));
650653
foreign_expn_data.into_iter().for_each(debug_expn_data);
@@ -1208,6 +1211,7 @@ impl HygieneEncodeContext {
12081211
// It's fine to iterate over a HashMap, because the serialization
12091212
// of the table that we insert data into doesn't depend on insertion
12101213
// order
1214+
#[allow(rustc::potential_query_instability)]
12111215
for_all_ctxts_in(latest_ctxts.into_iter(), |index, ctxt, data| {
12121216
if self.serialized_ctxts.lock().insert(ctxt) {
12131217
encode_ctxt(encoder, index, data);
@@ -1216,6 +1220,8 @@ impl HygieneEncodeContext {
12161220

12171221
let latest_expns = { std::mem::take(&mut *self.latest_expns.lock()) };
12181222

1223+
// Same as above, this is fine as we are inserting into a order-independent hashset
1224+
#[allow(rustc::potential_query_instability)]
12191225
for_all_expns_in(latest_expns.into_iter(), |expn, data, hash| {
12201226
if self.serialized_expns.lock().insert(expn) {
12211227
encode_expn(encoder, expn, data, hash);

compiler/rustc_span/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#![feature(negative_impls)]
2121
#![feature(min_specialization)]
2222
#![feature(rustc_attrs)]
23-
#![allow(rustc::potential_query_instability)]
2423

2524
#[macro_use]
2625
extern crate rustc_macros;

0 commit comments

Comments
 (0)