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_interface/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_interface/src')
| -rw-r--r-- | compiler/rustc_interface/src/callbacks.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_interface/src/errors.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_interface/src/interface.rs | 15 | ||||
| -rw-r--r-- | compiler/rustc_interface/src/passes.rs | 23 | ||||
| -rw-r--r-- | compiler/rustc_interface/src/queries.rs | 13 | ||||
| -rw-r--r-- | compiler/rustc_interface/src/tests.rs | 37 | ||||
| -rw-r--r-- | compiler/rustc_interface/src/util.rs | 21 |
7 files changed, 57 insertions, 61 deletions
diff --git a/compiler/rustc_interface/src/callbacks.rs b/compiler/rustc_interface/src/callbacks.rs index a27f73789cd..786e2bb511f 100644 --- a/compiler/rustc_interface/src/callbacks.rs +++ b/compiler/rustc_interface/src/callbacks.rs @@ -9,12 +9,13 @@ //! The functions in this file should fall back to the default set in their //! origin crate when the `TyCtxt` is not present in TLS. +use std::fmt; + use rustc_errors::{DiagInner, TRACK_DIAGNOSTIC}; use rustc_middle::dep_graph::{DepNodeExt, TaskDepsRef}; use rustc_middle::ty::tls; use rustc_query_system::dep_graph::dep_node::default_dep_kind_debug; use rustc_query_system::dep_graph::{DepContext, DepKind, DepNode}; -use std::fmt; fn track_span_parent(def_id: rustc_span::def_id::LocalDefId) { tls::with_opt(|tcx| { diff --git a/compiler/rustc_interface/src/errors.rs b/compiler/rustc_interface/src/errors.rs index 29294003b8f..939980a932f 100644 --- a/compiler/rustc_interface/src/errors.rs +++ b/compiler/rustc_interface/src/errors.rs @@ -1,9 +1,9 @@ -use rustc_macros::Diagnostic; -use rustc_span::{Span, Symbol}; - use std::io; use std::path::Path; +use rustc_macros::Diagnostic; +use rustc_span::{Span, Symbol}; + #[derive(Diagnostic)] #[diag(interface_ferris_identifier)] pub struct FerrisIdentifier { diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index dba20e4a335..886b043af24 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -1,13 +1,13 @@ -use crate::util; +use std::path::PathBuf; +use std::result; +use std::sync::Arc; -use rustc_ast::token; -use rustc_ast::{LitKind, MetaItemKind}; +use rustc_ast::{token, LitKind, MetaItemKind}; use rustc_codegen_ssa::traits::CodegenBackend; -use rustc_data_structures::defer; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; -use rustc_data_structures::jobserver; use rustc_data_structures::stable_hasher::StableHasher; use rustc_data_structures::sync::Lrc; +use rustc_data_structures::{defer, jobserver}; use rustc_errors::registry::Registry; use rustc_errors::{DiagCtxtHandle, ErrorGuaranteed}; use rustc_lint::LintStore; @@ -24,11 +24,10 @@ use rustc_session::{lint, CompilerIO, EarlyDiagCtxt, Session}; use rustc_span::source_map::{FileLoader, RealFileLoader, SourceMapInputs}; use rustc_span::symbol::sym; use rustc_span::FileName; -use std::path::PathBuf; -use std::result; -use std::sync::Arc; use tracing::trace; +use crate::util; + pub type Result<T> = result::Result<T, ErrorGuaranteed>; /// Represents a compiler session. Note that every `Compiler` contains a diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index 2951f50b1f5..a5e25b917dc 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -1,7 +1,9 @@ -use crate::errors; -use crate::interface::{Compiler, Result}; -use crate::proc_macro_decls; -use crate::util; +use std::any::Any; +use std::ffi::OsString; +use std::io::{self, BufWriter, Write}; +use std::path::{Path, PathBuf}; +use std::sync::{Arc, LazyLock}; +use std::{env, fs, iter}; use rustc_ast::{self as ast, visit}; use rustc_codegen_ssa::traits::CodegenBackend; @@ -27,23 +29,18 @@ use rustc_resolve::Resolver; use rustc_session::code_stats::VTableSizeInfo; use rustc_session::config::{CrateType, Input, OutFileName, OutputFilenames, OutputType}; use rustc_session::cstore::Untracked; -use rustc_session::output::filename_for_input; -use rustc_session::output::{collect_crate_types, find_crate_name}; +use rustc_session::output::{collect_crate_types, filename_for_input, find_crate_name}; use rustc_session::search_paths::PathKind; use rustc_session::{Limit, Session}; use rustc_span::symbol::{sym, Symbol}; use rustc_span::FileName; use rustc_target::spec::PanicStrategy; use rustc_trait_selection::traits; - -use std::any::Any; -use std::ffi::OsString; -use std::io::{self, BufWriter, Write}; -use std::path::{Path, PathBuf}; -use std::sync::{Arc, LazyLock}; -use std::{env, fs, iter}; use tracing::{info, instrument}; +use crate::interface::{Compiler, Result}; +use crate::{errors, proc_macro_decls, util}; + pub(crate) fn parse<'a>(sess: &'a Session) -> Result<ast::Crate> { let krate = sess .time("parse_crate", || { diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs index 821e8ee7ba5..c5d56c15c6e 100644 --- a/compiler/rustc_interface/src/queries.rs +++ b/compiler/rustc_interface/src/queries.rs @@ -1,6 +1,6 @@ -use crate::errors::FailedWritingFile; -use crate::interface::{Compiler, Result}; -use crate::{errors, passes}; +use std::any::Any; +use std::cell::{RefCell, RefMut}; +use std::sync::Arc; use rustc_ast as ast; use rustc_codegen_ssa::traits::CodegenBackend; @@ -15,9 +15,10 @@ use rustc_middle::ty::{GlobalCtxt, TyCtxt}; use rustc_serialize::opaque::FileEncodeResult; use rustc_session::config::{self, OutputFilenames, OutputType}; use rustc_session::Session; -use std::any::Any; -use std::cell::{RefCell, RefMut}; -use std::sync::Arc; + +use crate::errors::FailedWritingFile; +use crate::interface::{Compiler, Result}; +use crate::{errors, passes}; /// Represent the result of a query. /// diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 7d7a6a08bee..ce3b2f77f21 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -1,23 +1,20 @@ #![allow(rustc::bad_opt_access)] -use crate::interface::{initialize_checked_jobserver, parse_cfg}; +use std::collections::{BTreeMap, BTreeSet}; +use std::num::NonZero; +use std::path::{Path, PathBuf}; +use std::sync::Arc; + use rustc_data_structures::profiling::TimePassesFormat; -use rustc_errors::{emitter::HumanReadableErrorType, registry, ColorConfig}; -use rustc_session::config::{build_configuration, build_session_options, rustc_optgroups}; -use rustc_session::config::{ - BranchProtection, CFGuard, Cfg, CollapseMacroDebuginfo, CoverageLevel, CoverageOptions, - DebugInfo, DumpMonoStatsFormat, ErrorOutputType, -}; -use rustc_session::config::{ - ExternEntry, ExternLocation, Externs, FunctionReturn, InliningThreshold, Input, - InstrumentCoverage, InstrumentXRay, LinkSelfContained, LinkerPluginLto, -}; -use rustc_session::config::{ - LocationDetail, LtoCli, NextSolverConfig, OomStrategy, Options, OutFileName, OutputType, - OutputTypes, PAuthKey, PacRet, Passes, PatchableFunctionEntry, -}; +use rustc_errors::emitter::HumanReadableErrorType; +use rustc_errors::{registry, ColorConfig}; use rustc_session::config::{ - Polonius, ProcMacroExecutionStrategy, Strip, SwitchWithOptPath, SymbolManglingVersion, - WasiExecModel, + build_configuration, build_session_options, rustc_optgroups, BranchProtection, CFGuard, Cfg, + CollapseMacroDebuginfo, CoverageLevel, CoverageOptions, DebugInfo, DumpMonoStatsFormat, + ErrorOutputType, ExternEntry, ExternLocation, Externs, FunctionReturn, InliningThreshold, + Input, InstrumentCoverage, InstrumentXRay, LinkSelfContained, LinkerPluginLto, LocationDetail, + LtoCli, NextSolverConfig, OomStrategy, Options, OutFileName, OutputType, OutputTypes, PAuthKey, + PacRet, Passes, PatchableFunctionEntry, Polonius, ProcMacroExecutionStrategy, Strip, + SwitchWithOptPath, SymbolManglingVersion, WasiExecModel, }; use rustc_session::lint::Level; use rustc_session::search_paths::SearchPath; @@ -31,10 +28,8 @@ use rustc_target::spec::{ CodeModel, FramePointer, LinkerFlavorCli, MergeFunctions, OnBrokenPipe, PanicStrategy, RelocModel, RelroLevel, SanitizerSet, SplitDebuginfo, StackProtector, TlsModel, WasmCAbi, }; -use std::collections::{BTreeMap, BTreeSet}; -use std::num::NonZero; -use std::path::{Path, PathBuf}; -use std::sync::Arc; + +use crate::interface::{initialize_checked_jobserver, parse_cfg}; fn sess_and_cfg<F>(args: &[&'static str], f: F) where diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs index 8dac524bb5b..6f53b1c9031 100644 --- a/compiler/rustc_interface/src/util.rs +++ b/compiler/rustc_interface/src/util.rs @@ -1,4 +1,9 @@ -use crate::errors; +use std::env::consts::{DLL_PREFIX, DLL_SUFFIX}; +use std::path::{Path, PathBuf}; +use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::OnceLock; +use std::{env, iter, thread}; + use rustc_ast as ast; use rustc_codegen_ssa::traits::CodegenBackend; #[cfg(parallel_compiler)] @@ -16,14 +21,10 @@ use rustc_span::edition::Edition; use rustc_span::source_map::SourceMapInputs; use rustc_span::symbol::sym; use rustc_target::spec::Target; -use std::env::consts::{DLL_PREFIX, DLL_SUFFIX}; -use std::path::{Path, PathBuf}; -use std::sync::atomic::{AtomicBool, Ordering}; -use std::sync::OnceLock; -use std::thread; -use std::{env, iter}; use tracing::info; +use crate::errors; + /// Function pointer type that constructs a new CodegenBackend. pub type MakeBackendFn = fn() -> Box<dyn CodegenBackend>; @@ -136,11 +137,13 @@ pub(crate) fn run_in_thread_pool_with_globals<F: FnOnce(CurrentGcx) -> R + Send, sm_inputs: SourceMapInputs, f: F, ) -> R { - use rustc_data_structures::{defer, jobserver, sync::FromDyn}; + use std::process; + + use rustc_data_structures::sync::FromDyn; + use rustc_data_structures::{defer, jobserver}; use rustc_middle::ty::tls; use rustc_query_impl::QueryCtxt; use rustc_query_system::query::{break_query_cycles, QueryContext}; - use std::process; let thread_stack_size = init_stack_size(thread_builder_diag); |
