1
Fork 0

Reformat use declarations.

The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
This commit is contained in:
Nicholas Nethercote 2024-07-29 08:13:50 +10:00
parent 118f9350c5
commit 84ac80f192
1865 changed files with 8367 additions and 9199 deletions

View file

@ -1,11 +1,11 @@
//! Cache for candidate selection.
use crate::dep_graph::{DepContext, DepNodeIndex};
use std::hash::Hash;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::sync::Lock;
use std::hash::Hash;
use crate::dep_graph::{DepContext, DepNodeIndex};
pub struct Cache<Key, Value> {
hashmap: Lock<FxHashMap<Key, WithDepNode<Value>>>,

View file

@ -1,9 +1,11 @@
//! Code for debugging the dep-graph.
use super::{DepNode, DepNodeIndex};
use std::error::Error;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::sync::Lock;
use std::error::Error;
use super::{DepNode, DepNodeIndex};
/// A dep-node filter goes from a user-defined string to a query over
/// nodes. Right now the format is like this:

View file

@ -42,16 +42,17 @@
//! `DefId` it was computed from. In other cases, too much information gets
//! lost during fingerprint computation.
use super::{DepContext, FingerprintStyle};
use crate::ich::StableHashingContext;
use std::fmt;
use std::hash::Hash;
use rustc_data_structures::fingerprint::{Fingerprint, PackedFingerprint};
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableOrd, ToStableHashKey};
use rustc_data_structures::AtomicRef;
use rustc_hir::definitions::DefPathHash;
use rustc_macros::{Decodable, Encodable};
use std::fmt;
use std::hash::Hash;
use super::{DepContext, FingerprintStyle};
use crate::ich::StableHashingContext;
/// This serves as an index into arrays built by `make_dep_kind_array`.
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
@ -312,8 +313,9 @@ impl StableOrd for WorkProductId {
// Some types are used a lot. Make sure they don't unintentionally get bigger.
#[cfg(target_pointer_width = "64")]
mod size_asserts {
use super::*;
use rustc_data_structures::static_assert_size;
use super::*;
// tidy-alphabetical-start
static_assert_size!(DepKind, 2);
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]

View file

@ -1,8 +1,10 @@
use crate::dep_graph::DepNodeIndex;
use smallvec::SmallVec;
use std::hash::{Hash, Hasher};
use std::ops::Deref;
use smallvec::SmallVec;
use crate::dep_graph::DepNodeIndex;
#[derive(Default, Debug)]
pub(crate) struct EdgesVec {
max: u32,

View file

@ -1,3 +1,11 @@
use std::assert_matches::assert_matches;
use std::collections::hash_map::Entry;
use std::fmt::Debug;
use std::hash::Hash;
use std::marker::PhantomData;
use std::sync::atomic::Ordering;
use std::sync::Arc;
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::profiling::{QueryInvocationId, SelfProfilerRef};
@ -8,14 +16,9 @@ use rustc_data_structures::unord::UnordMap;
use rustc_index::IndexVec;
use rustc_macros::{Decodable, Encodable};
use rustc_serialize::opaque::{FileEncodeResult, FileEncoder};
use std::assert_matches::assert_matches;
use std::collections::hash_map::Entry;
use std::fmt::Debug;
use std::hash::Hash;
use std::marker::PhantomData;
use std::sync::atomic::Ordering;
use std::sync::Arc;
use tracing::{debug, instrument};
#[cfg(debug_assertions)]
use {super::debug::EdgeFilter, std::env};
use super::query::DepGraphQuery;
use super::serialized::{GraphEncoder, SerializedDepGraph, SerializedDepNodeIndex};
@ -24,9 +27,6 @@ use crate::dep_graph::edges::EdgesVec;
use crate::ich::StableHashingContext;
use crate::query::{QueryContext, QuerySideEffects};
#[cfg(debug_assertions)]
use {super::debug::EdgeFilter, std::env};
#[derive(Clone)]
pub struct DepGraph<D: Deps> {
data: Option<Lrc<DepGraphData<D>>>,

View file

@ -5,18 +5,19 @@ mod graph;
mod query;
mod serialized;
use std::panic;
pub use dep_node::{DepKind, DepKindStruct, DepNode, DepNodeParams, WorkProductId};
pub(crate) use graph::DepGraphData;
pub use graph::{hash_result, DepGraph, DepNodeIndex, TaskDepsRef, WorkProduct, WorkProductMap};
pub use query::DepGraphQuery;
use rustc_data_structures::profiling::SelfProfilerRef;
use rustc_session::Session;
pub use serialized::{SerializedDepGraph, SerializedDepNodeIndex};
use tracing::instrument;
use self::graph::{print_markframe_trace, MarkFrame};
use crate::ich::StableHashingContext;
use rustc_data_structures::profiling::SelfProfilerRef;
use rustc_session::Session;
use std::panic;
use tracing::instrument;
pub trait DepContext: Copy {
type Deps: Deps;

View file

@ -35,11 +35,11 @@
//! If the number of edges in this node does not fit in the bits available in the header, we
//! store it directly after the header with leb128.
use super::query::DepGraphQuery;
use super::{DepKind, DepNode, DepNodeIndex, Deps};
use crate::dep_graph::edges::EdgesVec;
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fingerprint::PackedFingerprint;
use std::iter;
use std::marker::PhantomData;
use std::sync::Arc;
use rustc_data_structures::fingerprint::{Fingerprint, PackedFingerprint};
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::outline;
use rustc_data_structures::profiling::SelfProfilerRef;
@ -48,11 +48,12 @@ use rustc_data_structures::unhash::UnhashMap;
use rustc_index::{Idx, IndexVec};
use rustc_serialize::opaque::{FileEncodeResult, FileEncoder, IntEncodedWithFixedSize, MemDecoder};
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
use std::iter;
use std::marker::PhantomData;
use std::sync::Arc;
use tracing::{debug, instrument};
use super::query::DepGraphQuery;
use super::{DepKind, DepNode, DepNodeIndex, Deps};
use crate::dep_graph::edges::EdgesVec;
// The maximum value of `SerializedDepNodeIndex` leaves the upper two bits
// unused so that we can store multiple index types in `CompressedHybridIndex`,
// and use those bits to encode which index type it contains.

View file

@ -1,5 +1,3 @@
use crate::ich;
use rustc_ast as ast;
use rustc_data_structures::stable_hasher::{HashStable, HashingControls, StableHasher};
use rustc_data_structures::sync::Lrc;
@ -11,6 +9,8 @@ use rustc_span::source_map::SourceMap;
use rustc_span::symbol::Symbol;
use rustc_span::{BytePos, CachingSourceMapView, SourceFile, Span, SpanData, DUMMY_SP};
use crate::ich;
/// This is the context state available during incr. comp. hashing. It contains
/// enough information to transform `DefId`s and `HirId`s into stable `DefPath`s (i.e.,
/// a reference to the `TyCtxt`) and it holds a few caches for speeding up various

View file

@ -1,15 +1,15 @@
//! This module contains `HashStable` implementations for various data types
//! from `rustc_ast` in no particular order.
use crate::ich::StableHashingContext;
use std::assert_matches::assert_matches;
use rustc_ast as ast;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_span::SourceFile;
use std::assert_matches::assert_matches;
use smallvec::SmallVec;
use crate::ich::StableHashingContext;
impl<'ctx> rustc_target::HashStableContext for StableHashingContext<'ctx> {}
impl<'a> HashStable<StableHashingContext<'a>> for [ast::Attribute] {

View file

@ -1,8 +1,9 @@
//! ICH - Incremental Compilation Hash
pub use self::hcx::StableHashingContext;
use rustc_span::symbol::{sym, Symbol};
pub use self::hcx::StableHashingContext;
mod hcx;
mod impls_syntax;

View file

@ -14,9 +14,7 @@ pub mod ich;
pub mod query;
mod values;
pub use error::HandleCycleError;
pub use error::LayoutOfDepth;
pub use error::QueryOverflow;
pub use error::{HandleCycleError, LayoutOfDepth, QueryOverflow};
pub use values::Value;
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }

View file

@ -1,14 +1,14 @@
use crate::dep_graph::DepNodeIndex;
use std::fmt::Debug;
use std::hash::Hash;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::sharded::{self, Sharded};
use rustc_data_structures::sync::{Lock, OnceLock};
use rustc_hir::def_id::LOCAL_CRATE;
use rustc_index::{Idx, IndexVec};
use rustc_span::def_id::DefId;
use rustc_span::def_id::DefIndex;
use std::fmt::Debug;
use std::hash::Hash;
use rustc_span::def_id::{DefId, DefIndex};
use crate::dep_graph::DepNodeIndex;
pub trait QueryCache: Sized {
type Key: Hash + Eq + Copy + Debug;

View file

@ -1,16 +1,16 @@
//! Query configuration and description traits.
use std::fmt::Debug;
use std::hash::Hash;
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_span::ErrorGuaranteed;
use crate::dep_graph::{DepKind, DepNode, DepNodeParams, SerializedDepNodeIndex};
use crate::error::HandleCycleError;
use crate::ich::StableHashingContext;
use crate::query::caches::QueryCache;
use crate::query::DepNodeIndex;
use crate::query::{CycleError, QueryContext, QueryState};
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_span::ErrorGuaranteed;
use std::fmt::Debug;
use std::hash::Hash;
use crate::query::{CycleError, DepNodeIndex, QueryContext, QueryState};
pub type HashResult<V> = Option<fn(&mut StableHashingContext<'_>, &V) -> Fingerprint>;

View file

@ -1,18 +1,12 @@
use crate::dep_graph::DepContext;
use crate::error::CycleStack;
use crate::query::plumbing::CycleError;
use crate::query::DepKind;
use crate::query::{QueryContext, QueryStackFrame};
use std::hash::Hash;
use std::io::Write;
use std::num::NonZero;
use rustc_data_structures::fx::FxHashMap;
use rustc_errors::{Diag, DiagCtxtHandle};
use rustc_hir::def::DefKind;
use rustc_session::Session;
use rustc_span::Span;
use std::hash::Hash;
use std::io::Write;
use std::num::NonZero;
#[cfg(parallel_compiler)]
use {
parking_lot::{Condvar, Mutex},
@ -23,6 +17,11 @@ use {
std::sync::Arc,
};
use crate::dep_graph::DepContext;
use crate::error::CycleStack;
use crate::query::plumbing::CycleError;
use crate::query::{DepKind, QueryContext, QueryStackFrame};
/// Represents a span and a query key.
#[derive(Clone, Debug)]
pub struct QueryInfo {

View file

@ -12,10 +12,6 @@ mod caches;
pub use self::caches::{DefIdCache, DefaultCache, QueryCache, SingleCache, VecCache};
mod config;
pub use self::config::{HashResult, QueryConfig};
use crate::dep_graph::DepKind;
use crate::dep_graph::{DepNodeIndex, HasDepContext, SerializedDepNodeIndex};
use rustc_data_structures::stable_hasher::Hash64;
use rustc_data_structures::sync::Lock;
use rustc_errors::DiagInner;
@ -25,6 +21,9 @@ use rustc_span::def_id::DefId;
use rustc_span::Span;
use thin_vec::ThinVec;
pub use self::config::{HashResult, QueryConfig};
use crate::dep_graph::{DepKind, DepNodeIndex, HasDepContext, SerializedDepNodeIndex};
/// Description of a frame in the query stack.
///
/// This is mostly used in case of cycles for error reporting.

View file

@ -2,16 +2,12 @@
//! generate the actual methods on tcx which find and execute the provider,
//! manage the caches, and so forth.
use crate::dep_graph::DepGraphData;
use crate::dep_graph::{DepContext, DepNode, DepNodeIndex, DepNodeParams};
use crate::ich::StableHashingContext;
use crate::query::caches::QueryCache;
#[cfg(parallel_compiler)]
use crate::query::job::QueryLatch;
use crate::query::job::{report_cycle, QueryInfo, QueryJob, QueryJobId, QueryJobInfo};
use crate::query::SerializedDepNodeIndex;
use crate::query::{QueryContext, QueryMap, QuerySideEffects, QueryStackFrame};
use crate::HandleCycleError;
use std::cell::Cell;
use std::collections::hash_map::Entry;
use std::fmt::Debug;
use std::hash::Hash;
use std::mem;
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::sharded::Sharded;
@ -21,15 +17,20 @@ use rustc_data_structures::sync::Lock;
use rustc_data_structures::{outline, sync};
use rustc_errors::{Diag, FatalError, StashKey};
use rustc_span::{Span, DUMMY_SP};
use std::cell::Cell;
use std::collections::hash_map::Entry;
use std::fmt::Debug;
use std::hash::Hash;
use std::mem;
use thin_vec::ThinVec;
use tracing::instrument;
use super::QueryConfig;
use crate::dep_graph::{DepContext, DepGraphData, DepNode, DepNodeIndex, DepNodeParams};
use crate::ich::StableHashingContext;
use crate::query::caches::QueryCache;
#[cfg(parallel_compiler)]
use crate::query::job::QueryLatch;
use crate::query::job::{report_cycle, QueryInfo, QueryJob, QueryJobId, QueryJobInfo};
use crate::query::{
QueryContext, QueryMap, QuerySideEffects, QueryStackFrame, SerializedDepNodeIndex,
};
use crate::HandleCycleError;
pub struct QueryState<K> {
active: Sharded<FxHashMap<K, QueryResult>>,