Skip to content

Commit d3574be

Browse files
Rollup merge of #119527 - klensy:ordering, r=compiler-errors
don't reexport atomic::ordering via rustc_data_structures, use std import This looks simpler.
2 parents 5c9a8d7 + 5617361 commit d3574be

File tree

5 files changed

+13
-19
lines changed

5 files changed

+13
-19
lines changed

compiler/rustc_data_structures/src/sync.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ mod parallel;
5656
pub use parallel::scope;
5757
pub use parallel::{join, par_for_each_in, par_map, parallel_guard, try_par_for_each_in};
5858

59-
pub use std::sync::atomic::Ordering;
60-
pub use std::sync::atomic::Ordering::SeqCst;
61-
6259
pub use vec::{AppendOnlyIndexVec, AppendOnlyVec};
6360

6461
mod vec;
@@ -67,8 +64,7 @@ mod freeze;
6764
pub use freeze::{FreezeLock, FreezeReadGuard, FreezeWriteGuard};
6865

6966
mod mode {
70-
use super::Ordering;
71-
use std::sync::atomic::AtomicU8;
67+
use std::sync::atomic::{AtomicU8, Ordering};
7268

7369
const UNINITIALIZED: u8 = 0;
7470
const DYN_NOT_THREAD_SAFE: u8 = 1;
@@ -113,6 +109,7 @@ cfg_match! {
113109
cfg(not(parallel_compiler)) => {
114110
use std::ops::Add;
115111
use std::cell::Cell;
112+
use std::sync::atomic::Ordering;
116113

117114
pub unsafe auto trait Send {}
118115
pub unsafe auto trait Sync {}

compiler/rustc_driver_impl/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ use rustc_codegen_ssa::{traits::CodegenBackend, CodegenErrors, CodegenResults};
2525
use rustc_data_structures::profiling::{
2626
get_resident_set_size, print_time_passes_entry, TimePassesFormat,
2727
};
28-
use rustc_data_structures::sync::SeqCst;
2928
use rustc_errors::registry::{InvalidErrorCode, Registry};
3029
use rustc_errors::{markdown, ColorConfig};
3130
use rustc_errors::{DiagCtxt, ErrorGuaranteed, PResult};
@@ -476,7 +475,7 @@ fn run_compiler(
476475
eprintln!(
477476
"Fuel used by {}: {}",
478477
sess.opts.unstable_opts.print_fuel.as_ref().unwrap(),
479-
sess.print_fuel.load(SeqCst)
478+
sess.print_fuel.load(Ordering::SeqCst)
480479
);
481480
}
482481

compiler/rustc_query_impl/src/plumbing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl QueryContext for QueryCtxt<'_> {
6969
fn next_job_id(self) -> QueryJobId {
7070
QueryJobId(
7171
NonZeroU64::new(
72-
self.query_system.jobs.fetch_add(1, rustc_data_structures::sync::Ordering::Relaxed),
72+
self.query_system.jobs.fetch_add(1, std::sync::atomic::Ordering::Relaxed),
7373
)
7474
.unwrap(),
7575
)

compiler/rustc_query_system/src/dep_graph/graph.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc_data_structures::profiling::{EventId, QueryInvocationId, SelfProfilerR
44
use rustc_data_structures::sharded::{self, Sharded};
55
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
66
use rustc_data_structures::steal::Steal;
7-
use rustc_data_structures::sync::{AtomicU32, AtomicU64, Lock, Lrc, Ordering};
7+
use rustc_data_structures::sync::{AtomicU32, AtomicU64, Lock, Lrc};
88
use rustc_data_structures::unord::UnordMap;
99
use rustc_index::IndexVec;
1010
use rustc_serialize::opaque::{FileEncodeResult, FileEncoder};
@@ -13,7 +13,7 @@ use std::collections::hash_map::Entry;
1313
use std::fmt::Debug;
1414
use std::hash::Hash;
1515
use std::marker::PhantomData;
16-
use std::sync::atomic::Ordering::Relaxed;
16+
use std::sync::atomic::Ordering;
1717

1818
use super::query::DepGraphQuery;
1919
use super::serialized::{GraphEncoder, SerializedDepGraph, SerializedDepNodeIndex};
@@ -476,7 +476,7 @@ impl<D: Deps> DepGraph<D> {
476476
let task_deps = &mut *task_deps;
477477

478478
if cfg!(debug_assertions) {
479-
data.current.total_read_count.fetch_add(1, Relaxed);
479+
data.current.total_read_count.fetch_add(1, Ordering::Relaxed);
480480
}
481481

482482
// As long as we only have a low number of reads we can avoid doing a hash
@@ -506,7 +506,7 @@ impl<D: Deps> DepGraph<D> {
506506
}
507507
}
508508
} else if cfg!(debug_assertions) {
509-
data.current.total_duplicate_read_count.fetch_add(1, Relaxed);
509+
data.current.total_duplicate_read_count.fetch_add(1, Ordering::Relaxed);
510510
}
511511
})
512512
}
@@ -976,8 +976,8 @@ impl<D: Deps> DepGraph<D> {
976976
pub fn print_incremental_info(&self) {
977977
if let Some(data) = &self.data {
978978
data.current.encoder.borrow().print_incremental_info(
979-
data.current.total_read_count.load(Relaxed),
980-
data.current.total_duplicate_read_count.load(Relaxed),
979+
data.current.total_read_count.load(Ordering::Relaxed),
980+
data.current.total_duplicate_read_count.load(Ordering::Relaxed),
981981
)
982982
}
983983
}
@@ -992,7 +992,7 @@ impl<D: Deps> DepGraph<D> {
992992

993993
pub(crate) fn next_virtual_depnode_index(&self) -> DepNodeIndex {
994994
debug_assert!(self.data.is_none());
995-
let index = self.virtual_dep_node_index.fetch_add(1, Relaxed);
995+
let index = self.virtual_dep_node_index.fetch_add(1, Ordering::Relaxed);
996996
DepNodeIndex::from_u32(index)
997997
}
998998
}

compiler/rustc_session/src/session.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ use rustc_data_structures::flock;
1414
use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
1515
use rustc_data_structures::jobserver::{self, Client};
1616
use rustc_data_structures::profiling::{SelfProfiler, SelfProfilerRef};
17-
use rustc_data_structures::sync::{
18-
AtomicU64, DynSend, DynSync, Lock, Lrc, OneThread, Ordering::SeqCst,
19-
};
17+
use rustc_data_structures::sync::{AtomicU64, DynSend, DynSync, Lock, Lrc, OneThread};
2018
use rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitter;
2119
use rustc_errors::emitter::{DynEmitter, HumanEmitter, HumanReadableErrorType};
2220
use rustc_errors::json::JsonEmitter;
@@ -44,7 +42,7 @@ use std::fmt;
4442
use std::ops::{Div, Mul};
4543
use std::path::{Path, PathBuf};
4644
use std::str::FromStr;
47-
use std::sync::{atomic::AtomicBool, Arc};
45+
use std::sync::{atomic::AtomicBool, atomic::Ordering::SeqCst, Arc};
4846

4947
struct OptimizationFuel {
5048
/// If `-zfuel=crate=n` is specified, initially set to `n`, otherwise `0`.

0 commit comments

Comments
 (0)