diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2025-04-02 07:02:25 +0200 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2025-04-02 07:12:01 +0200 |
| commit | 027251ff7da03a6c190bfb1e1756a23085e3ff35 (patch) | |
| tree | 79e3beb4c04eb6b6bde881b3e35d7e0720d58f41 /compiler/rustc_query_system/src/dep_graph/graph.rs | |
| parent | 70dab5a27c03a5637cc1d4ba36a5139760d25e38 (diff) | |
| download | rust-027251ff7da03a6c190bfb1e1756a23085e3ff35.tar.gz rust-027251ff7da03a6c190bfb1e1756a23085e3ff35.zip | |
Use a session counter to make anon dep nodes unique
Diffstat (limited to 'compiler/rustc_query_system/src/dep_graph/graph.rs')
| -rw-r--r-- | compiler/rustc_query_system/src/dep_graph/graph.rs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/compiler/rustc_query_system/src/dep_graph/graph.rs b/compiler/rustc_query_system/src/dep_graph/graph.rs index 127dcd825da..abd6120bf9d 100644 --- a/compiler/rustc_query_system/src/dep_graph/graph.rs +++ b/compiler/rustc_query_system/src/dep_graph/graph.rs @@ -1167,8 +1167,7 @@ pub(super) struct CurrentDepGraph<D: Deps> { /// ID from the previous session. In order to side-step this problem, we make /// sure that anonymous `NodeId`s allocated in different sessions don't overlap. /// This is implemented by mixing a session-key into the ID fingerprint of - /// each anon node. The session-key is just a random number generated when - /// the `DepGraph` is created. + /// each anon node. The session-key is a hash of the number of previous sessions. anon_id_seed: Fingerprint, /// These are simple counters that are for profiling and @@ -1186,12 +1185,8 @@ impl<D: Deps> CurrentDepGraph<D> { record_stats: bool, previous: Arc<SerializedDepGraph>, ) -> Self { - use std::time::{SystemTime, UNIX_EPOCH}; - - let duration = SystemTime::now().duration_since(UNIX_EPOCH).unwrap(); - let nanos = duration.as_nanos(); let mut stable_hasher = StableHasher::new(); - nanos.hash(&mut stable_hasher); + previous.session_count().hash(&mut stable_hasher); let anon_id_seed = stable_hasher.finish(); #[cfg(debug_assertions)] |
