about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-09-25 06:41:56 +0000
committerbors <bors@rust-lang.org>2024-09-25 06:41:56 +0000
commit34aff74fb06e78fb9cd1a66acafb6d150638de35 (patch)
tree14533de260c2f1834994e58af1d210a6884625a9 /compiler/rustc_data_structures/src
parent938c7b1162a38dca257c7004ef7ecf86397a8634 (diff)
parent8be19465ec14880160d294f2909202451a547740 (diff)
downloadrust-34aff74fb06e78fb9cd1a66acafb6d150638de35.tar.gz
rust-34aff74fb06e78fb9cd1a66acafb6d150638de35.zip
Auto merge of #18183 - lnicola:sync-from-rust, r=lnicola
internal: Sync from downstream
Diffstat (limited to 'compiler/rustc_data_structures/src')
-rw-r--r--compiler/rustc_data_structures/src/base_n.rs2
-rw-r--r--compiler/rustc_data_structures/src/fingerprint.rs2
-rw-r--r--compiler/rustc_data_structures/src/flock/windows.rs4
-rw-r--r--compiler/rustc_data_structures/src/graph/dominators/tests.rs65
-rw-r--r--compiler/rustc_data_structures/src/graph/implementation/tests.rs11
-rw-r--r--compiler/rustc_data_structures/src/graph/scc/mod.rs2
-rw-r--r--compiler/rustc_data_structures/src/graph/scc/tests.rs83
-rw-r--r--compiler/rustc_data_structures/src/hashes.rs4
-rw-r--r--compiler/rustc_data_structures/src/obligation_forest/tests.rs8
-rw-r--r--compiler/rustc_data_structures/src/owned_slice/tests.rs4
-rw-r--r--compiler/rustc_data_structures/src/sharded.rs2
-rw-r--r--compiler/rustc_data_structures/src/stable_hasher.rs2
-rw-r--r--compiler/rustc_data_structures/src/steal.rs1
-rw-r--r--compiler/rustc_data_structures/src/sync/lock.rs2
-rw-r--r--compiler/rustc_data_structures/src/sync/parallel.rs6
-rw-r--r--compiler/rustc_data_structures/src/sync/worker_local.rs8
-rw-r--r--compiler/rustc_data_structures/src/work_queue.rs2
17 files changed, 108 insertions, 100 deletions
diff --git a/compiler/rustc_data_structures/src/base_n.rs b/compiler/rustc_data_structures/src/base_n.rs
index 1c2321623e4..0c3d7613d4f 100644
--- a/compiler/rustc_data_structures/src/base_n.rs
+++ b/compiler/rustc_data_structures/src/base_n.rs
@@ -42,7 +42,7 @@ impl fmt::Display for BaseNString {
 }
 
 // This trait just lets us reserve the exact right amount of space when doing fixed-length
-// case-insensitve encoding. Add any impls you need.
+// case-insensitive encoding. Add any impls you need.
 pub trait ToBaseN: Into<u128> {
     fn encoded_len(base: usize) -> usize;
 
diff --git a/compiler/rustc_data_structures/src/fingerprint.rs b/compiler/rustc_data_structures/src/fingerprint.rs
index efc56dc9337..16c66824c5b 100644
--- a/compiler/rustc_data_structures/src/fingerprint.rs
+++ b/compiler/rustc_data_structures/src/fingerprint.rs
@@ -3,7 +3,7 @@ use std::hash::{Hash, Hasher};
 use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
 
 use crate::stable_hasher::{
-    impl_stable_traits_for_trivial_type, FromStableHash, Hash64, StableHasherHash,
+    FromStableHash, Hash64, StableHasherHash, impl_stable_traits_for_trivial_type,
 };
 
 #[cfg(test)]
diff --git a/compiler/rustc_data_structures/src/flock/windows.rs b/compiler/rustc_data_structures/src/flock/windows.rs
index 0d76df27a0a..9739e501272 100644
--- a/compiler/rustc_data_structures/src/flock/windows.rs
+++ b/compiler/rustc_data_structures/src/flock/windows.rs
@@ -6,8 +6,8 @@ use std::path::Path;
 use tracing::debug;
 use windows::Win32::Foundation::{ERROR_INVALID_FUNCTION, HANDLE};
 use windows::Win32::Storage::FileSystem::{
-    LockFileEx, FILE_SHARE_DELETE, FILE_SHARE_READ, FILE_SHARE_WRITE, LOCKFILE_EXCLUSIVE_LOCK,
-    LOCKFILE_FAIL_IMMEDIATELY, LOCK_FILE_FLAGS,
+    FILE_SHARE_DELETE, FILE_SHARE_READ, FILE_SHARE_WRITE, LOCK_FILE_FLAGS, LOCKFILE_EXCLUSIVE_LOCK,
+    LOCKFILE_FAIL_IMMEDIATELY, LockFileEx,
 };
 use windows::Win32::System::IO::OVERLAPPED;
 
diff --git a/compiler/rustc_data_structures/src/graph/dominators/tests.rs b/compiler/rustc_data_structures/src/graph/dominators/tests.rs
index 6c078ca7c6e..ef82193a4b9 100644
--- a/compiler/rustc_data_structures/src/graph/dominators/tests.rs
+++ b/compiler/rustc_data_structures/src/graph/dominators/tests.rs
@@ -15,10 +15,17 @@ fn diamond() {
 #[test]
 fn paper() {
     // example from the paper:
-    let graph = TestGraph::new(
-        6,
-        &[(6, 5), (6, 4), (5, 1), (4, 2), (4, 3), (1, 2), (2, 3), (3, 2), (2, 1)],
-    );
+    let graph = TestGraph::new(6, &[
+        (6, 5),
+        (6, 4),
+        (5, 1),
+        (4, 2),
+        (4, 3),
+        (1, 2),
+        (2, 3),
+        (3, 2),
+        (2, 1),
+    ]);
 
     let d = dominators(&graph);
     assert_eq!(d.immediate_dominator(0), None); // <-- note that 0 is not in graph
@@ -33,10 +40,19 @@ fn paper() {
 #[test]
 fn paper_slt() {
     // example from the paper:
-    let graph = TestGraph::new(
-        1,
-        &[(1, 2), (1, 3), (2, 3), (2, 7), (3, 4), (3, 6), (4, 5), (5, 4), (6, 7), (7, 8), (8, 5)],
-    );
+    let graph = TestGraph::new(1, &[
+        (1, 2),
+        (1, 3),
+        (2, 3),
+        (2, 7),
+        (3, 4),
+        (3, 6),
+        (4, 5),
+        (5, 4),
+        (6, 7),
+        (7, 8),
+        (8, 5),
+    ]);
 
     dominators(&graph);
 }
@@ -53,24 +69,21 @@ fn immediate_dominator() {
 
 #[test]
 fn transitive_dominator() {
-    let graph = TestGraph::new(
-        0,
-        &[
-            // First tree branch.
-            (0, 1),
-            (1, 2),
-            (2, 3),
-            (3, 4),
-            // Second tree branch.
-            (1, 5),
-            (5, 6),
-            // Third tree branch.
-            (0, 7),
-            // These links make 0 the dominator for 2 and 3.
-            (7, 2),
-            (5, 3),
-        ],
-    );
+    let graph = TestGraph::new(0, &[
+        // First tree branch.
+        (0, 1),
+        (1, 2),
+        (2, 3),
+        (3, 4),
+        // Second tree branch.
+        (1, 5),
+        (5, 6),
+        // Third tree branch.
+        (0, 7),
+        // These links make 0 the dominator for 2 and 3.
+        (7, 2),
+        (5, 3),
+    ]);
 
     let d = dominators(&graph);
     assert_eq!(d.immediate_dominator(2), Some(0));
diff --git a/compiler/rustc_data_structures/src/graph/implementation/tests.rs b/compiler/rustc_data_structures/src/graph/implementation/tests.rs
index 32a6d9ec881..7a240f4e58b 100644
--- a/compiler/rustc_data_structures/src/graph/implementation/tests.rs
+++ b/compiler/rustc_data_structures/src/graph/implementation/tests.rs
@@ -110,13 +110,10 @@ fn each_adjacent_from_a() {
 #[test]
 fn each_adjacent_from_b() {
     let graph = create_graph();
-    test_adjacent_edges(
-        &graph,
-        NodeIndex(1),
-        "B",
-        &[("FB", "F"), ("AB", "A")],
-        &[("BD", "D"), ("BC", "C")],
-    );
+    test_adjacent_edges(&graph, NodeIndex(1), "B", &[("FB", "F"), ("AB", "A")], &[
+        ("BD", "D"),
+        ("BC", "C"),
+    ]);
 }
 
 #[test]
diff --git a/compiler/rustc_data_structures/src/graph/scc/mod.rs b/compiler/rustc_data_structures/src/graph/scc/mod.rs
index 2a457ffb70b..06fedef00fc 100644
--- a/compiler/rustc_data_structures/src/graph/scc/mod.rs
+++ b/compiler/rustc_data_structures/src/graph/scc/mod.rs
@@ -477,7 +477,7 @@ where
         // will know when we hit the state where previous_node == node.
         loop {
             // Back at the beginning, we can return. Note that we return the root state.
-            // This is becuse for components being explored, we would otherwise get a
+            // This is because for components being explored, we would otherwise get a
             // `node_state[n] = InCycleWith{ parent: n }` and that's wrong.
             if previous_node == node {
                 return root_state;
diff --git a/compiler/rustc_data_structures/src/graph/scc/tests.rs b/compiler/rustc_data_structures/src/graph/scc/tests.rs
index 373f87bfdbc..7c876c82af2 100644
--- a/compiler/rustc_data_structures/src/graph/scc/tests.rs
+++ b/compiler/rustc_data_structures/src/graph/scc/tests.rs
@@ -326,49 +326,46 @@ fn test_bug_max_leak_minimised() {
 
 #[test]
 fn test_bug_max_leak() {
-    let graph = TestGraph::new(
-        8,
-        &[
-            (0, 0),
-            (0, 18),
-            (0, 19),
-            (0, 1),
-            (0, 2),
-            (0, 7),
-            (0, 8),
-            (0, 23),
-            (18, 0),
-            (18, 12),
-            (19, 0),
-            (19, 25),
-            (12, 18),
-            (12, 3),
-            (12, 5),
-            (3, 12),
-            (3, 21),
-            (3, 22),
-            (5, 13),
-            (21, 3),
-            (22, 3),
-            (13, 5),
-            (13, 4),
-            (4, 13),
-            (4, 0),
-            (2, 11),
-            (7, 6),
-            (6, 20),
-            (20, 6),
-            (8, 17),
-            (17, 9),
-            (9, 16),
-            (16, 26),
-            (26, 15),
-            (15, 10),
-            (10, 14),
-            (14, 27),
-            (23, 24),
-        ],
-    );
+    let graph = TestGraph::new(8, &[
+        (0, 0),
+        (0, 18),
+        (0, 19),
+        (0, 1),
+        (0, 2),
+        (0, 7),
+        (0, 8),
+        (0, 23),
+        (18, 0),
+        (18, 12),
+        (19, 0),
+        (19, 25),
+        (12, 18),
+        (12, 3),
+        (12, 5),
+        (3, 12),
+        (3, 21),
+        (3, 22),
+        (5, 13),
+        (21, 3),
+        (22, 3),
+        (13, 5),
+        (13, 4),
+        (4, 13),
+        (4, 0),
+        (2, 11),
+        (7, 6),
+        (6, 20),
+        (20, 6),
+        (8, 17),
+        (17, 9),
+        (9, 16),
+        (16, 26),
+        (26, 15),
+        (15, 10),
+        (10, 14),
+        (14, 27),
+        (23, 24),
+    ]);
     let sccs: MaxReachedSccs = Sccs::new_with_annotation(&graph, |w| match w {
         22 => MaxReached(1),
         24 => MaxReached(2),
diff --git a/compiler/rustc_data_structures/src/hashes.rs b/compiler/rustc_data_structures/src/hashes.rs
index f98c8de1eb0..8f4639fc2e6 100644
--- a/compiler/rustc_data_structures/src/hashes.rs
+++ b/compiler/rustc_data_structures/src/hashes.rs
@@ -3,11 +3,11 @@
 //! or 16 bytes of the hash.
 //!
 //! The types in this module represent 64-bit or 128-bit hashes produced by a `StableHasher`.
-//! `Hash64` and `Hash128` expose some utilty functions to encourage users to not extract the inner
+//! `Hash64` and `Hash128` expose some utility functions to encourage users to not extract the inner
 //! hash value as an integer type and accidentally apply varint encoding to it.
 //!
 //! In contrast with `Fingerprint`, users of these types cannot and should not attempt to construct
-//! and decompose these types into constitutent pieces. The point of these types is only to
+//! and decompose these types into constituent pieces. The point of these types is only to
 //! connect the fact that they can only be produced by a `StableHasher` to their
 //! `Encode`/`Decode` impls.
 
diff --git a/compiler/rustc_data_structures/src/obligation_forest/tests.rs b/compiler/rustc_data_structures/src/obligation_forest/tests.rs
index a58c6ee1bcc..8391e98ba8b 100644
--- a/compiler/rustc_data_structures/src/obligation_forest/tests.rs
+++ b/compiler/rustc_data_structures/src/obligation_forest/tests.rs
@@ -347,10 +347,10 @@ fn diamond() {
     ));
     assert_eq!(d_count, 1);
     assert_eq!(ok.len(), 0);
-    assert_eq!(
-        err,
-        vec![super::Error { error: "operation failed", backtrace: vec!["D'", "A'.1", "A'"] }]
-    );
+    assert_eq!(err, vec![super::Error {
+        error: "operation failed",
+        backtrace: vec!["D'", "A'.1", "A'"]
+    }]);
 
     let errors = forest.to_errors(());
     assert_eq!(errors.len(), 0);
diff --git a/compiler/rustc_data_structures/src/owned_slice/tests.rs b/compiler/rustc_data_structures/src/owned_slice/tests.rs
index 324b8ecf2d3..e9ef7ea5afc 100644
--- a/compiler/rustc_data_structures/src/owned_slice/tests.rs
+++ b/compiler/rustc_data_structures/src/owned_slice/tests.rs
@@ -1,9 +1,9 @@
 use std::ops::Deref;
-use std::sync::atomic::{self, AtomicBool};
 use std::sync::Arc;
+use std::sync::atomic::{self, AtomicBool};
 
 use crate::defer;
-use crate::owned_slice::{slice_owned, try_slice_owned, OwnedSlice};
+use crate::owned_slice::{OwnedSlice, slice_owned, try_slice_owned};
 
 #[test]
 fn smoke() {
diff --git a/compiler/rustc_data_structures/src/sharded.rs b/compiler/rustc_data_structures/src/sharded.rs
index 03aa1d8f678..d0b6fe2bc6f 100644
--- a/compiler/rustc_data_structures/src/sharded.rs
+++ b/compiler/rustc_data_structures/src/sharded.rs
@@ -8,7 +8,7 @@ use either::Either;
 
 use crate::fx::{FxHashMap, FxHasher};
 #[cfg(parallel_compiler)]
-use crate::sync::{is_dyn_thread_safe, CacheAligned};
+use crate::sync::{CacheAligned, is_dyn_thread_safe};
 use crate::sync::{Lock, LockGuard, Mode};
 
 // 32 shards is sufficient to reduce contention on an 8-core Ryzen 7 1700,
diff --git a/compiler/rustc_data_structures/src/stable_hasher.rs b/compiler/rustc_data_structures/src/stable_hasher.rs
index 9673f94d7a4..0872bd2c9ac 100644
--- a/compiler/rustc_data_structures/src/stable_hasher.rs
+++ b/compiler/rustc_data_structures/src/stable_hasher.rs
@@ -14,7 +14,7 @@ pub use rustc_stable_hash::{
     FromStableHash, SipHasher128Hash as StableHasherHash, StableSipHasher128 as StableHasher,
 };
 
-pub use crate::hashes::{Hash128, Hash64};
+pub use crate::hashes::{Hash64, Hash128};
 
 /// Something that implements `HashStable<CTX>` can be hashed in a way that is
 /// stable across multiple compilation sessions.
diff --git a/compiler/rustc_data_structures/src/steal.rs b/compiler/rustc_data_structures/src/steal.rs
index 0f2c0eee27d..aaa95f6b7f1 100644
--- a/compiler/rustc_data_structures/src/steal.rs
+++ b/compiler/rustc_data_structures/src/steal.rs
@@ -57,6 +57,7 @@ impl<T> Steal<T> {
     ///
     /// This should not be used within rustc as it leaks information not tracked
     /// by the query system, breaking incremental compilation.
+    #[cfg_attr(not(bootstrap), rustc_lint_untracked_query_information)]
     pub fn is_stolen(&self) -> bool {
         self.value.borrow().is_none()
     }
diff --git a/compiler/rustc_data_structures/src/sync/lock.rs b/compiler/rustc_data_structures/src/sync/lock.rs
index 7cf942685e3..012ee7f900e 100644
--- a/compiler/rustc_data_structures/src/sync/lock.rs
+++ b/compiler/rustc_data_structures/src/sync/lock.rs
@@ -25,8 +25,8 @@ mod maybe_sync {
     use std::mem::ManuallyDrop;
     use std::ops::{Deref, DerefMut};
 
-    use parking_lot::lock_api::RawMutex as _;
     use parking_lot::RawMutex;
+    use parking_lot::lock_api::RawMutex as _;
 
     use super::Mode;
     use crate::sync::mode;
diff --git a/compiler/rustc_data_structures/src/sync/parallel.rs b/compiler/rustc_data_structures/src/sync/parallel.rs
index 2b89431c2ed..c7df19842d6 100644
--- a/compiler/rustc_data_structures/src/sync/parallel.rs
+++ b/compiler/rustc_data_structures/src/sync/parallel.rs
@@ -4,7 +4,7 @@
 #![allow(dead_code)]
 
 use std::any::Any;
-use std::panic::{catch_unwind, resume_unwind, AssertUnwindSafe};
+use std::panic::{AssertUnwindSafe, catch_unwind, resume_unwind};
 
 #[cfg(not(parallel_compiler))]
 pub use disabled::*;
@@ -12,8 +12,8 @@ pub use disabled::*;
 pub use enabled::*;
 use parking_lot::Mutex;
 
-use crate::sync::IntoDynSyncSend;
 use crate::FatalErrorMarker;
+use crate::sync::IntoDynSyncSend;
 
 /// A guard used to hold panics that occur during a parallel section to later by unwound.
 /// This is used for the parallel compiler to prevent fatal errors from non-deterministically
@@ -102,7 +102,7 @@ mod disabled {
 
 #[cfg(parallel_compiler)]
 mod enabled {
-    use crate::sync::{mode, parallel_guard, DynSend, DynSync, FromDyn};
+    use crate::sync::{DynSend, DynSync, FromDyn, mode, parallel_guard};
 
     /// Runs a list of blocks in parallel. The first block is executed immediately on
     /// the current thread. Use that for the longest running block.
diff --git a/compiler/rustc_data_structures/src/sync/worker_local.rs b/compiler/rustc_data_structures/src/sync/worker_local.rs
index 4950481d311..b6efcada10b 100644
--- a/compiler/rustc_data_structures/src/sync/worker_local.rs
+++ b/compiler/rustc_data_structures/src/sync/worker_local.rs
@@ -19,7 +19,7 @@ impl RegistryId {
     /// index within the registry. This panics if the current thread is not associated with this
     /// registry.
     ///
-    /// Note that there's a race possible where the identifer in `THREAD_DATA` could be reused
+    /// Note that there's a race possible where the identifier in `THREAD_DATA` could be reused
     /// so this can succeed from a different registry.
     #[cfg(parallel_compiler)]
     fn verify(self) -> usize {
@@ -50,7 +50,7 @@ struct ThreadData {
 }
 
 thread_local! {
-    /// A thread local which contains the identifer of `REGISTRY` but allows for faster access.
+    /// A thread local which contains the identifier of `REGISTRY` but allows for faster access.
     /// It also holds the index of the current thread.
     static THREAD_DATA: ThreadData = const { ThreadData {
         registry_id: Cell::new(RegistryId(ptr::null())),
@@ -66,7 +66,7 @@ impl Registry {
 
     /// Gets the registry associated with the current thread. Panics if there's no such registry.
     pub fn current() -> Self {
-        REGISTRY.with(|registry| registry.get().cloned().expect("No assocated registry"))
+        REGISTRY.with(|registry| registry.get().cloned().expect("No associated registry"))
     }
 
     /// Registers the current thread with the registry so worker locals can be used on it.
@@ -92,7 +92,7 @@ impl Registry {
         }
     }
 
-    /// Gets the identifer of this registry.
+    /// Gets the identifier of this registry.
     fn id(&self) -> RegistryId {
         RegistryId(&*self.0)
     }
diff --git a/compiler/rustc_data_structures/src/work_queue.rs b/compiler/rustc_data_structures/src/work_queue.rs
index 490d7d3ddd5..ca052e2eac6 100644
--- a/compiler/rustc_data_structures/src/work_queue.rs
+++ b/compiler/rustc_data_structures/src/work_queue.rs
@@ -1,7 +1,7 @@
 use std::collections::VecDeque;
 
-use rustc_index::bit_set::BitSet;
 use rustc_index::Idx;
+use rustc_index::bit_set::BitSet;
 
 /// A work queue is a handy data structure for tracking work left to
 /// do. (For example, basic blocks left to process.) It is basically a