Skip to content

Commit 7b07162

Browse files
committed
Auto merge of #2500 - Hiroki6:make-vector-clock-private, r=RalfJung
move vector_clock and sync into concurrency & make vector_clock private Closes #2199 The thread.rs didn't have to be moved to build. If it makes more sense to move the thread.rs as well, please let me know. I can move it as well.
2 parents ab88e64 + 8ee6849 commit 7b07162

File tree

9 files changed

+14
-11
lines changed

9 files changed

+14
-11
lines changed

src/concurrency/data_race.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ use rustc_target::abi::{Align, Size};
5454

5555
use crate::*;
5656

57-
use super::weak_memory::EvalContextExt as _;
57+
use super::{
58+
vector_clock::{VClock, VTimestamp, VectorIdx},
59+
weak_memory::EvalContextExt as _,
60+
};
5861

5962
pub type AllocExtra = VClockAlloc;
6063

src/concurrency/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
pub mod data_race;
22
mod range_object_map;
3+
pub mod sync;
4+
mod vector_clock;
35
pub mod weak_memory;

src/sync.rs renamed to src/concurrency/sync.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use log::trace;
77
use rustc_data_structures::fx::FxHashMap;
88
use rustc_index::vec::{Idx, IndexVec};
99

10+
use super::vector_clock::VClock;
1011
use crate::*;
1112

1213
/// We cannot use the `newtype_index!` macro because we have to use 0 as a
@@ -150,7 +151,7 @@ struct FutexWaiter {
150151

151152
/// The state of all synchronization variables.
152153
#[derive(Default, Debug)]
153-
pub(super) struct SynchronizationState {
154+
pub(crate) struct SynchronizationState {
154155
mutexes: IndexVec<MutexId, Mutex>,
155156
rwlocks: IndexVec<RwLockId, RwLock>,
156157
condvars: IndexVec<CondvarId, Condvar>,
File renamed without changes.

src/concurrency/weak_memory.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ use crate::*;
8787
use super::{
8888
data_race::{GlobalState as DataRaceState, ThreadClockSet},
8989
range_object_map::{AccessType, RangeObjectMap},
90+
vector_clock::{VClock, VTimestamp, VectorIdx},
9091
};
9192

9293
pub type AllocExtra = StoreBufferAlloc;

src/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ mod operator;
6161
mod range_map;
6262
mod shims;
6363
mod stacked_borrows;
64-
mod sync;
65-
mod thread;
66-
mod vector_clock;
64+
pub mod thread;
6765

6866
// Establish a "crate-wide prelude": we often import `crate::*`.
6967

@@ -105,12 +103,10 @@ pub use crate::range_map::RangeMap;
105103
pub use crate::stacked_borrows::{
106104
CallId, EvalContextExt as StackedBorEvalContextExt, Item, Permission, SbTag, Stack, Stacks,
107105
};
108-
pub use crate::sync::{CondvarId, EvalContextExt as SyncEvalContextExt, MutexId, RwLockId};
109106
pub use crate::thread::{
110107
EvalContextExt as ThreadsEvalContextExt, SchedulingAction, ThreadId, ThreadManager, ThreadState,
111108
};
112-
pub use crate::vector_clock::{VClock, VTimestamp, VectorIdx};
113-
109+
pub use concurrency::sync::{CondvarId, EvalContextExt as SyncEvalContextExt, MutexId, RwLockId};
114110
/// Insert rustc arguments at the beginning of the argument list that Miri wants to be
115111
/// set per default, for maximal validation power.
116112
pub const MIRI_DEFAULT_ARGS: &[&str] = &[

src/shims/time.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::time::{Duration, Instant, SystemTime};
22

3+
use crate::thread::Time;
34
use crate::*;
4-
use thread::Time;
55

66
/// Returns the time elapsed between the provided time and the unix epoch as a `Duration`.
77
pub fn system_time_to_duration<'tcx>(time: &SystemTime) -> InterpResult<'tcx, Duration> {

src/shims/unix/sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use std::time::SystemTime;
33
use rustc_hir::LangItem;
44
use rustc_middle::ty::{layout::TyAndLayout, query::TyCtxtAt, subst::Subst, Ty};
55

6+
use crate::thread::Time;
67
use crate::*;
7-
use thread::Time;
88

99
// pthread_mutexattr_t is either 4 or 8 bytes, depending on the platform.
1010

src/thread.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use rustc_middle::ty::layout::TyAndLayout;
1515
use rustc_target::spec::abi::Abi;
1616

1717
use crate::concurrency::data_race;
18-
use crate::sync::SynchronizationState;
18+
use crate::concurrency::sync::SynchronizationState;
1919
use crate::*;
2020

2121
#[derive(Clone, Copy, Debug, PartialEq, Eq)]

0 commit comments

Comments
 (0)