Skip to content

Commit c0dbd99

Browse files
Move AtomicU64 usage to AtomicUsize
1 parent 47bb760 commit c0dbd99

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

src/librustc/dep_graph/graph.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
33
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
44
use rustc_index::vec::{Idx, IndexVec};
55
use smallvec::SmallVec;
6-
use rustc_data_structures::sync::{Lrc, Lock, AtomicU32, AtomicU64, Ordering};
6+
use rustc_data_structures::sync::{Lrc, Lock, AtomicU32, AtomicUsize, Ordering};
77
use rustc_data_structures::sharded::{self, Sharded};
88
use std::sync::atomic::Ordering::SeqCst;
99
use std::env;
@@ -485,8 +485,8 @@ impl DepGraph {
485485
if cfg!(debug_assertions) {
486486
let current_dep_graph = &self.data.as_ref().unwrap().current;
487487

488-
Some((current_dep_graph.total_read_count.load(SeqCst),
489-
current_dep_graph.total_duplicate_read_count.load(SeqCst)))
488+
Some((current_dep_graph.total_read_count.load(SeqCst) as u64,
489+
current_dep_graph.total_duplicate_read_count.load(SeqCst) as u64))
490490
} else {
491491
None
492492
}
@@ -970,8 +970,8 @@ pub(super) struct CurrentDepGraph {
970970

971971
/// These are simple counters that are for profiling and
972972
/// debugging and only active with `debug_assertions`.
973-
total_read_count: AtomicU64,
974-
total_duplicate_read_count: AtomicU64,
973+
total_read_count: AtomicUsize,
974+
total_duplicate_read_count: AtomicUsize,
975975
}
976976

977977
impl CurrentDepGraph {
@@ -1012,8 +1012,8 @@ impl CurrentDepGraph {
10121012
)),
10131013
anon_id_seed: stable_hasher.finish(),
10141014
forbidden_edge,
1015-
total_read_count: AtomicU64::new(0),
1016-
total_duplicate_read_count: AtomicU64::new(0),
1015+
total_read_count: AtomicUsize::new(0),
1016+
total_duplicate_read_count: AtomicUsize::new(0),
10171017
}
10181018
}
10191019

src/librustc_data_structures/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#![feature(integer_atomics)]
2525
#![feature(test)]
2626
#![feature(associated_type_bounds)]
27+
#![feature(cfg_target_has_atomic)]
2728

2829
#![cfg_attr(unix, feature(libc))]
2930

src/librustc_data_structures/sync.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,9 @@ cfg_if! {
317317
pub use parking_lot::MutexGuard as LockGuard;
318318
pub use parking_lot::MappedMutexGuard as MappedLockGuard;
319319

320-
pub use std::sync::atomic::{AtomicBool, AtomicUsize, AtomicU32, AtomicU64};
320+
pub use std::sync::atomic::{AtomicBool, AtomicUsize, AtomicU32};
321+
#[cfg(target_has_atomic = "64")]
322+
pub use std::sync::atomic::{AtomicU64};
321323

322324
pub use crossbeam_utils::atomic::AtomicCell;
323325

src/librustc_session/session.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_errors::ErrorReported;
1414

1515
use rustc_data_structures::base_n;
1616
use rustc_data_structures::sync::{
17-
self, Lrc, Lock, OneThread, Once, AtomicU64, AtomicUsize, Ordering,
17+
self, Lrc, Lock, OneThread, Once, AtomicUsize, Ordering,
1818
Ordering::SeqCst,
1919
};
2020
use rustc_data_structures::impl_stable_hash_via_hash;
@@ -119,7 +119,7 @@ pub struct Session {
119119
/// If `-zprint-fuel=crate`, `Some(crate)`.
120120
pub print_fuel_crate: Option<String>,
121121
/// Always set to zero and incremented so that we can print fuel expended by a crate.
122-
pub print_fuel: AtomicU64,
122+
pub print_fuel: AtomicUsize,
123123

124124
/// Loaded up early on in the initialization of this `Session` to avoid
125125
/// false positives about a job server in our environment.
@@ -1116,7 +1116,7 @@ fn build_session_(
11161116
out_of_fuel: false,
11171117
});
11181118
let print_fuel_crate = sopts.debugging_opts.print_fuel.clone();
1119-
let print_fuel = AtomicU64::new(0);
1119+
let print_fuel = AtomicUsize::new(0);
11201120

11211121
let working_dir = env::current_dir().unwrap_or_else(|e|
11221122
parse_sess.span_diagnostic

0 commit comments

Comments
 (0)