diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-07-29 08:13:50 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-07-29 08:26:52 +1000 |
| commit | 84ac80f1921afc243d71fd0caaa4f2838c294102 (patch) | |
| tree | 29006db815bf547dfd0129910b23b8c54675bd98 /compiler/rustc_incremental/src | |
| parent | 118f9350c5b902e462a6dcc4325670f3da701600 (diff) | |
| download | rust-84ac80f1921afc243d71fd0caaa4f2838c294102.tar.gz rust-84ac80f1921afc243d71fd0caaa4f2838c294102.zip | |
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.
Diffstat (limited to 'compiler/rustc_incremental/src')
| -rw-r--r-- | compiler/rustc_incremental/src/assert_dep_graph.rs | 14 | ||||
| -rw-r--r-- | compiler/rustc_incremental/src/errors.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_incremental/src/lib.rs | 14 | ||||
| -rw-r--r-- | compiler/rustc_incremental/src/persist/dirty_clean.rs | 7 | ||||
| -rw-r--r-- | compiler/rustc_incremental/src/persist/file_format.rs | 13 | ||||
| -rw-r--r-- | compiler/rustc_incremental/src/persist/fs.rs | 23 | ||||
| -rw-r--r-- | compiler/rustc_incremental/src/persist/load.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_incremental/src/persist/mod.rs | 11 | ||||
| -rw-r--r-- | compiler/rustc_incremental/src/persist/save.rs | 13 | ||||
| -rw-r--r-- | compiler/rustc_incremental/src/persist/work_product.rs | 10 |
10 files changed, 56 insertions, 65 deletions
diff --git a/compiler/rustc_incremental/src/assert_dep_graph.rs b/compiler/rustc_incremental/src/assert_dep_graph.rs index 41caa5d4765..b29ba59c9f3 100644 --- a/compiler/rustc_incremental/src/assert_dep_graph.rs +++ b/compiler/rustc_incremental/src/assert_dep_graph.rs @@ -33,12 +33,12 @@ //! fn baz() { foo(); } //! ``` -use crate::errors; -use rustc_ast as ast; +use std::env; +use std::fs::{self, File}; +use std::io::{BufWriter, Write}; + use rustc_data_structures::fx::FxIndexSet; use rustc_data_structures::graph::implementation::{Direction, NodeIndex, INCOMING, OUTGOING}; -use rustc_graphviz as dot; -use rustc_hir as hir; use rustc_hir::def_id::{DefId, LocalDefId, CRATE_DEF_ID}; use rustc_hir::intravisit::{self, Visitor}; use rustc_middle::dep_graph::{ @@ -49,10 +49,10 @@ use rustc_middle::ty::TyCtxt; use rustc_middle::{bug, span_bug}; use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; -use std::env; -use std::fs::{self, File}; -use std::io::{BufWriter, Write}; use tracing::debug; +use {rustc_ast as ast, rustc_graphviz as dot, rustc_hir as hir}; + +use crate::errors; #[allow(missing_docs)] pub fn assert_dep_graph(tcx: TyCtxt<'_>) { diff --git a/compiler/rustc_incremental/src/errors.rs b/compiler/rustc_incremental/src/errors.rs index e94a7fb876b..f8910030634 100644 --- a/compiler/rustc_incremental/src/errors.rs +++ b/compiler/rustc_incremental/src/errors.rs @@ -1,7 +1,9 @@ -use rustc_macros::Diagnostic; -use rustc_span::{symbol::Ident, Span, Symbol}; use std::path::{Path, PathBuf}; +use rustc_macros::Diagnostic; +use rustc_span::symbol::Ident; +use rustc_span::{Span, Symbol}; + #[derive(Diagnostic)] #[diag(incremental_unrecognized_depnode)] pub struct UnrecognizedDepNode { diff --git a/compiler/rustc_incremental/src/lib.rs b/compiler/rustc_incremental/src/lib.rs index 76e3c0682de..fcdcb08eed6 100644 --- a/compiler/rustc_incremental/src/lib.rs +++ b/compiler/rustc_incremental/src/lib.rs @@ -12,14 +12,10 @@ mod assert_dep_graph; mod errors; mod persist; -pub use persist::copy_cgu_workproduct_to_incr_comp_cache_dir; -pub use persist::finalize_session_directory; -pub use persist::in_incr_comp_dir; -pub use persist::in_incr_comp_dir_sess; -pub use persist::load_query_result_cache; -pub use persist::save_dep_graph; -pub use persist::save_work_product_index; -pub use persist::setup_dep_graph; -pub use persist::LoadResult; +pub use persist::{ + copy_cgu_workproduct_to_incr_comp_cache_dir, finalize_session_directory, in_incr_comp_dir, + in_incr_comp_dir_sess, load_query_result_cache, save_dep_graph, save_work_product_index, + setup_dep_graph, LoadResult, +}; rustc_fluent_macro::fluent_messages! { "../messages.ftl" } diff --git a/compiler/rustc_incremental/src/persist/dirty_clean.rs b/compiler/rustc_incremental/src/persist/dirty_clean.rs index 2a0d681fa37..1e02324f404 100644 --- a/compiler/rustc_incremental/src/persist/dirty_clean.rs +++ b/compiler/rustc_incremental/src/persist/dirty_clean.rs @@ -19,14 +19,11 @@ //! Errors are reported if we are in the suitable configuration but //! the required condition is not met. -use crate::errors; use rustc_ast::{self as ast, Attribute, NestedMetaItem}; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::unord::UnordSet; use rustc_hir::def_id::LocalDefId; -use rustc_hir::intravisit; -use rustc_hir::Node as HirNode; -use rustc_hir::{ImplItemKind, ItemKind as HirItem, TraitItemKind}; +use rustc_hir::{intravisit, ImplItemKind, ItemKind as HirItem, Node as HirNode, TraitItemKind}; use rustc_middle::dep_graph::{label_strs, DepNode, DepNodeExt}; use rustc_middle::hir::nested_filter; use rustc_middle::ty::TyCtxt; @@ -35,6 +32,8 @@ use rustc_span::Span; use thin_vec::ThinVec; use tracing::debug; +use crate::errors; + const LOADED_FROM_DISK: Symbol = sym::loaded_from_disk; const EXCEPT: Symbol = sym::except; const CFG: Symbol = sym::cfg; diff --git a/compiler/rustc_incremental/src/persist/file_format.rs b/compiler/rustc_incremental/src/persist/file_format.rs index 303785bdb22..174414d0c85 100644 --- a/compiler/rustc_incremental/src/persist/file_format.rs +++ b/compiler/rustc_incremental/src/persist/file_format.rs @@ -9,18 +9,19 @@ //! compiler versions don't change frequently for the typical user, being //! conservative here practically has no downside. -use crate::errors; +use std::borrow::Cow; +use std::io::{self, Read}; +use std::path::{Path, PathBuf}; +use std::{env, fs}; + use rustc_data_structures::memmap::Mmap; use rustc_serialize::opaque::{FileEncodeResult, FileEncoder}; use rustc_serialize::Encoder; use rustc_session::Session; -use std::borrow::Cow; -use std::env; -use std::fs; -use std::io::{self, Read}; -use std::path::{Path, PathBuf}; use tracing::debug; +use crate::errors; + /// The first few bytes of files generated by incremental compilation. const FILE_MAGIC: &[u8] = b"RSIC"; diff --git a/compiler/rustc_incremental/src/persist/fs.rs b/compiler/rustc_incremental/src/persist/fs.rs index 9afea3d66b0..5f85e622e89 100644 --- a/compiler/rustc_incremental/src/persist/fs.rs +++ b/compiler/rustc_incremental/src/persist/fs.rs @@ -103,30 +103,27 @@ //! unsupported file system and emit a warning in that case. This is not yet //! implemented. -use crate::errors; -use rustc_data_structures::base_n; -use rustc_data_structures::base_n::BaseNString; -use rustc_data_structures::base_n::ToBaseN; -use rustc_data_structures::base_n::CASE_INSENSITIVE; -use rustc_data_structures::flock; +use std::fs as std_fs; +use std::io::{self, ErrorKind}; +use std::path::{Path, PathBuf}; +use std::time::{Duration, SystemTime, UNIX_EPOCH}; + +use rand::{thread_rng, RngCore}; +use rustc_data_structures::base_n::{BaseNString, ToBaseN, CASE_INSENSITIVE}; use rustc_data_structures::fx::{FxHashSet, FxIndexSet}; use rustc_data_structures::svh::Svh; use rustc_data_structures::unord::{UnordMap, UnordSet}; +use rustc_data_structures::{base_n, flock}; use rustc_errors::ErrorGuaranteed; use rustc_fs_util::{link_or_copy, try_canonicalize, LinkOrCopy}; use rustc_middle::bug; use rustc_session::config::CrateType; use rustc_session::output::{collect_crate_types, find_crate_name}; use rustc_session::{Session, StableCrateId}; - -use std::fs as std_fs; -use std::io::{self, ErrorKind}; -use std::path::{Path, PathBuf}; -use std::time::{Duration, SystemTime, UNIX_EPOCH}; - -use rand::{thread_rng, RngCore}; use tracing::debug; +use crate::errors; + #[cfg(test)] mod tests; diff --git a/compiler/rustc_incremental/src/persist/load.rs b/compiler/rustc_incremental/src/persist/load.rs index af667a57ce1..18088a10dd0 100644 --- a/compiler/rustc_incremental/src/persist/load.rs +++ b/compiler/rustc_incremental/src/persist/load.rs @@ -1,6 +1,8 @@ //! Code to load the dep-graph from files. -use crate::errors; +use std::path::{Path, PathBuf}; +use std::sync::Arc; + use rustc_data_structures::memmap::Mmap; use rustc_data_structures::unord::UnordMap; use rustc_middle::dep_graph::{DepGraph, DepsType, SerializedDepGraph, WorkProductMap}; @@ -10,15 +12,13 @@ use rustc_serialize::Decodable; use rustc_session::config::IncrementalStateAssertion; use rustc_session::Session; use rustc_span::ErrorGuaranteed; -use std::path::{Path, PathBuf}; -use std::sync::Arc; use tracing::{debug, warn}; use super::data::*; -use super::file_format; use super::fs::*; use super::save::build_dep_graph; -use super::work_product; +use super::{file_format, work_product}; +use crate::errors; #[derive(Debug)] /// Represents the result of an attempt to load incremental compilation data. diff --git a/compiler/rustc_incremental/src/persist/mod.rs b/compiler/rustc_incremental/src/persist/mod.rs index 94c05f4a2c8..a529b1dcec0 100644 --- a/compiler/rustc_incremental/src/persist/mod.rs +++ b/compiler/rustc_incremental/src/persist/mod.rs @@ -10,12 +10,7 @@ mod load; mod save; mod work_product; -pub use fs::finalize_session_directory; -pub use fs::in_incr_comp_dir; -pub use fs::in_incr_comp_dir_sess; -pub use load::load_query_result_cache; -pub use load::setup_dep_graph; -pub use load::LoadResult; -pub use save::save_dep_graph; -pub use save::save_work_product_index; +pub use fs::{finalize_session_directory, in_incr_comp_dir, in_incr_comp_dir_sess}; +pub use load::{load_query_result_cache, setup_dep_graph, LoadResult}; +pub use save::{save_dep_graph, save_work_product_index}; pub use work_product::copy_cgu_workproduct_to_incr_comp_cache_dir; diff --git a/compiler/rustc_incremental/src/persist/save.rs b/compiler/rustc_incremental/src/persist/save.rs index 3bf582bd26c..58a03cb8b30 100644 --- a/compiler/rustc_incremental/src/persist/save.rs +++ b/compiler/rustc_incremental/src/persist/save.rs @@ -1,5 +1,6 @@ -use crate::assert_dep_graph::assert_dep_graph; -use crate::errors; +use std::fs; +use std::sync::Arc; + use rustc_data_structures::fx::FxIndexMap; use rustc_data_structures::sync::join; use rustc_middle::dep_graph::{ @@ -9,15 +10,13 @@ use rustc_middle::ty::TyCtxt; use rustc_serialize::opaque::{FileEncodeResult, FileEncoder}; use rustc_serialize::Encodable as RustcEncodable; use rustc_session::Session; -use std::fs; -use std::sync::Arc; use tracing::debug; use super::data::*; -use super::dirty_clean; -use super::file_format; use super::fs::*; -use super::work_product; +use super::{dirty_clean, file_format, work_product}; +use crate::assert_dep_graph::assert_dep_graph; +use crate::errors; /// Saves and writes the [`DepGraph`] to the file system. /// diff --git a/compiler/rustc_incremental/src/persist/work_product.rs b/compiler/rustc_incremental/src/persist/work_product.rs index e230da9dfb1..048981f0d5c 100644 --- a/compiler/rustc_incremental/src/persist/work_product.rs +++ b/compiler/rustc_incremental/src/persist/work_product.rs @@ -2,16 +2,18 @@ //! //! [work products]: WorkProduct -use crate::errors; -use crate::persist::fs::*; +use std::fs as std_fs; +use std::path::Path; + use rustc_data_structures::unord::UnordMap; use rustc_fs_util::link_or_copy; use rustc_middle::dep_graph::{WorkProduct, WorkProductId}; use rustc_session::Session; -use std::fs as std_fs; -use std::path::Path; use tracing::debug; +use crate::errors; +use crate::persist::fs::*; + /// Copies a CGU work product to the incremental compilation directory, so next compilation can /// find and reuse it. pub fn copy_cgu_workproduct_to_incr_comp_cache_dir( |
