1
Fork 0

Reformat using the new identifier sorting from rustfmt

This commit is contained in:
Michael Goulet 2024-09-22 19:05:04 -04:00
parent 1173204b36
commit c682aa162b
1455 changed files with 7152 additions and 8384 deletions

View file

@ -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)]

View file

@ -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;

View file

@ -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));

View file

@ -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]

View file

@ -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),

View file

@ -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);

View file

@ -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() {

View file

@ -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,

View file

@ -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.

View file

@ -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;

View file

@ -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.

View file

@ -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