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_mir_dataflow | |
| 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_mir_dataflow')
16 files changed, 59 insertions, 65 deletions
diff --git a/compiler/rustc_mir_dataflow/src/drop_flag_effects.rs b/compiler/rustc_mir_dataflow/src/drop_flag_effects.rs index 82c59d7d959..4f67a0fa095 100644 --- a/compiler/rustc_mir_dataflow/src/drop_flag_effects.rs +++ b/compiler/rustc_mir_dataflow/src/drop_flag_effects.rs @@ -1,10 +1,10 @@ -use crate::elaborate_drops::DropFlagState; use rustc_middle::mir::{self, Body, Location, Terminator, TerminatorKind}; use rustc_target::abi::VariantIdx; use tracing::debug; use super::move_paths::{InitKind, LookupResult, MoveData, MovePathIndex}; use super::MoveDataParamEnv; +use crate::elaborate_drops::DropFlagState; pub fn move_path_children_matching<'tcx, F>( move_data: &MoveData<'tcx>, diff --git a/compiler/rustc_mir_dataflow/src/elaborate_drops.rs b/compiler/rustc_mir_dataflow/src/elaborate_drops.rs index e0da9600ae3..2ec3b53bc98 100644 --- a/compiler/rustc_mir_dataflow/src/elaborate_drops.rs +++ b/compiler/rustc_mir_dataflow/src/elaborate_drops.rs @@ -1,3 +1,5 @@ +use std::{fmt, iter}; + use rustc_hir::lang_items::LangItem; use rustc_index::Idx; use rustc_middle::mir::patch::MirPatch; @@ -5,12 +7,10 @@ use rustc_middle::mir::*; use rustc_middle::span_bug; use rustc_middle::traits::Reveal; use rustc_middle::ty::util::IntTypeExt; -use rustc_middle::ty::GenericArgsRef; -use rustc_middle::ty::{self, Ty, TyCtxt}; +use rustc_middle::ty::{self, GenericArgsRef, Ty, TyCtxt}; use rustc_span::source_map::Spanned; use rustc_span::DUMMY_SP; use rustc_target::abi::{FieldIdx, VariantIdx, FIRST_VARIANT}; -use std::{fmt, iter}; use tracing::{debug, instrument}; /// The value of an inserted drop flag. diff --git a/compiler/rustc_mir_dataflow/src/framework/cursor.rs b/compiler/rustc_mir_dataflow/src/framework/cursor.rs index 1bd9167be12..7cfaef22689 100644 --- a/compiler/rustc_mir_dataflow/src/framework/cursor.rs +++ b/compiler/rustc_mir_dataflow/src/framework/cursor.rs @@ -1,7 +1,5 @@ //! Random access inspection of the results of a dataflow analysis. -use crate::framework::BitSetExt; - use std::cmp::Ordering; #[cfg(debug_assertions)] @@ -9,6 +7,7 @@ use rustc_index::bit_set::BitSet; use rustc_middle::mir::{self, BasicBlock, Location}; use super::{Analysis, Direction, Effect, EffectIndex, Results}; +use crate::framework::BitSetExt; /// Allows random access inspection of the results of a dataflow analysis. /// diff --git a/compiler/rustc_mir_dataflow/src/framework/direction.rs b/compiler/rustc_mir_dataflow/src/framework/direction.rs index f57e8b8bd6f..ba4a7d76511 100644 --- a/compiler/rustc_mir_dataflow/src/framework/direction.rs +++ b/compiler/rustc_mir_dataflow/src/framework/direction.rs @@ -1,7 +1,8 @@ +use std::ops::RangeInclusive; + use rustc_middle::mir::{ self, BasicBlock, CallReturnPlaces, Location, SwitchTargets, TerminatorEdges, }; -use std::ops::RangeInclusive; use super::visitor::{ResultsVisitable, ResultsVisitor}; use super::{Analysis, Effect, EffectIndex, GenKillAnalysis, GenKillSet, SwitchIntTarget}; diff --git a/compiler/rustc_mir_dataflow/src/framework/engine.rs b/compiler/rustc_mir_dataflow/src/framework/engine.rs index 564a99e5df8..364a416480f 100644 --- a/compiler/rustc_mir_dataflow/src/framework/engine.rs +++ b/compiler/rustc_mir_dataflow/src/framework/engine.rs @@ -1,32 +1,28 @@ //! A solver for dataflow problems. -use crate::errors::{ - DuplicateValuesFor, PathMustEndInFilename, RequiresAnArgument, UnknownFormatter, -}; -use crate::framework::BitSetExt; - use std::ffi::OsString; use std::path::PathBuf; -use rustc_ast as ast; use rustc_data_structures::work_queue::WorkQueue; -use rustc_graphviz as dot; use rustc_hir::def_id::DefId; use rustc_index::{Idx, IndexVec}; use rustc_middle::bug; -use rustc_middle::mir::{self, traversal, BasicBlock}; -use rustc_middle::mir::{create_dump_file, dump_enabled}; +use rustc_middle::mir::{self, create_dump_file, dump_enabled, traversal, BasicBlock}; use rustc_middle::ty::print::with_no_trimmed_paths; use rustc_middle::ty::TyCtxt; use rustc_span::symbol::{sym, Symbol}; use tracing::{debug, error}; +use {rustc_ast as ast, rustc_graphviz as dot}; use super::fmt::DebugWithContext; -use super::graphviz; use super::{ - visit_results, Analysis, AnalysisDomain, Direction, GenKill, GenKillAnalysis, GenKillSet, - JoinSemiLattice, ResultsCursor, ResultsVisitor, + graphviz, visit_results, Analysis, AnalysisDomain, Direction, GenKill, GenKillAnalysis, + GenKillSet, JoinSemiLattice, ResultsCursor, ResultsVisitor, }; +use crate::errors::{ + DuplicateValuesFor, PathMustEndInFilename, RequiresAnArgument, UnknownFormatter, +}; +use crate::framework::BitSetExt; pub type EntrySets<'tcx, A> = IndexVec<BasicBlock, <A as AnalysisDomain<'tcx>>::Domain>; diff --git a/compiler/rustc_mir_dataflow/src/framework/fmt.rs b/compiler/rustc_mir_dataflow/src/framework/fmt.rs index e3a66bd952c..5e4f36e4ae3 100644 --- a/compiler/rustc_mir_dataflow/src/framework/fmt.rs +++ b/compiler/rustc_mir_dataflow/src/framework/fmt.rs @@ -1,10 +1,12 @@ //! Custom formatting traits used when outputting Graphviz diagrams with the results of a dataflow //! analysis. -use super::lattice::MaybeReachable; +use std::fmt; + use rustc_index::bit_set::{BitSet, ChunkedBitSet, HybridBitSet}; use rustc_index::Idx; -use std::fmt; + +use super::lattice::MaybeReachable; /// An extension to `fmt::Debug` for data that can be better printed with some auxiliary data `C`. pub trait DebugWithContext<C>: Eq + fmt::Debug { diff --git a/compiler/rustc_mir_dataflow/src/framework/graphviz.rs b/compiler/rustc_mir_dataflow/src/framework/graphviz.rs index a827f6a8dbd..2e860e2d841 100644 --- a/compiler/rustc_mir_dataflow/src/framework/graphviz.rs +++ b/compiler/rustc_mir_dataflow/src/framework/graphviz.rs @@ -8,8 +8,7 @@ use std::{io, ops, str}; use regex::Regex; use rustc_graphviz as dot; use rustc_index::bit_set::BitSet; -use rustc_middle::mir::graphviz_safe_def_name; -use rustc_middle::mir::{self, BasicBlock, Body, Location}; +use rustc_middle::mir::{self, graphviz_safe_def_name, BasicBlock, Body, Location}; use super::fmt::{DebugDiffWithAdapter, DebugWithAdapter, DebugWithContext}; use super::{Analysis, CallReturnPlaces, Direction, Results, ResultsCursor, ResultsVisitor}; diff --git a/compiler/rustc_mir_dataflow/src/framework/lattice.rs b/compiler/rustc_mir_dataflow/src/framework/lattice.rs index 23738f7a4a5..4d03ee53b7c 100644 --- a/compiler/rustc_mir_dataflow/src/framework/lattice.rs +++ b/compiler/rustc_mir_dataflow/src/framework/lattice.rs @@ -38,10 +38,12 @@ //! [Hasse diagram]: https://en.wikipedia.org/wiki/Hasse_diagram //! [poset]: https://en.wikipedia.org/wiki/Partially_ordered_set -use crate::framework::BitSetExt; +use std::iter; + use rustc_index::bit_set::{BitSet, ChunkedBitSet, HybridBitSet}; use rustc_index::{Idx, IndexVec}; -use std::iter; + +use crate::framework::BitSetExt; /// A [partially ordered set][poset] that has a [least upper bound][lub] for any pair of elements /// in the set. diff --git a/compiler/rustc_mir_dataflow/src/impls/initialized.rs b/compiler/rustc_mir_dataflow/src/impls/initialized.rs index d44da42416d..77f4dcf892a 100644 --- a/compiler/rustc_mir_dataflow/src/impls/initialized.rs +++ b/compiler/rustc_mir_dataflow/src/impls/initialized.rs @@ -5,15 +5,14 @@ use rustc_middle::mir::{self, Body, CallReturnPlaces, Location, TerminatorEdges} use rustc_middle::ty::{self, TyCtxt}; use tracing::{debug, instrument}; -use crate::drop_flag_effects_for_function_entry; -use crate::drop_flag_effects_for_location; use crate::elaborate_drops::DropFlagState; use crate::framework::SwitchIntEdgeEffects; use crate::move_paths::{HasMoveData, InitIndex, InitKind, LookupResult, MoveData, MovePathIndex}; -use crate::on_lookup_result_bits; -use crate::MoveDataParamEnv; -use crate::{drop_flag_effects, on_all_children_bits}; -use crate::{lattice, AnalysisDomain, GenKill, GenKillAnalysis, MaybeReachable}; +use crate::{ + drop_flag_effects, drop_flag_effects_for_function_entry, drop_flag_effects_for_location, + lattice, on_all_children_bits, on_lookup_result_bits, AnalysisDomain, GenKill, GenKillAnalysis, + MaybeReachable, MoveDataParamEnv, +}; /// `MaybeInitializedPlaces` tracks all places that might be /// initialized upon reaching a particular point in the control flow diff --git a/compiler/rustc_mir_dataflow/src/impls/mod.rs b/compiler/rustc_mir_dataflow/src/impls/mod.rs index f8db18fc1f8..f283660e1e7 100644 --- a/compiler/rustc_mir_dataflow/src/impls/mod.rs +++ b/compiler/rustc_mir_dataflow/src/impls/mod.rs @@ -7,13 +7,12 @@ mod initialized; mod liveness; mod storage_liveness; -pub use self::borrowed_locals::borrowed_locals; -pub use self::borrowed_locals::MaybeBorrowedLocals; +pub use self::borrowed_locals::{borrowed_locals, MaybeBorrowedLocals}; pub use self::initialized::{ DefinitelyInitializedPlaces, EverInitializedPlaces, MaybeInitializedPlaces, MaybeUninitializedPlaces, }; -pub use self::liveness::MaybeLiveLocals; -pub use self::liveness::MaybeTransitiveLiveLocals; -pub use self::liveness::TransferFunction as LivenessTransferFunction; +pub use self::liveness::{ + MaybeLiveLocals, MaybeTransitiveLiveLocals, TransferFunction as LivenessTransferFunction, +}; pub use self::storage_liveness::{MaybeRequiresStorage, MaybeStorageDead, MaybeStorageLive}; diff --git a/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs b/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs index 682cec12f1f..9f2f0187698 100644 --- a/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs +++ b/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs @@ -1,9 +1,9 @@ +use std::borrow::Cow; + use rustc_index::bit_set::BitSet; use rustc_middle::mir::visit::{NonMutatingUseContext, PlaceContext, Visitor}; use rustc_middle::mir::*; -use std::borrow::Cow; - use super::MaybeBorrowedLocals; use crate::{GenKill, ResultsCursor}; diff --git a/compiler/rustc_mir_dataflow/src/move_paths/builder.rs b/compiler/rustc_mir_dataflow/src/move_paths/builder.rs index 7b39db821d8..c26a72e4543 100644 --- a/compiler/rustc_mir_dataflow/src/move_paths/builder.rs +++ b/compiler/rustc_mir_dataflow/src/move_paths/builder.rs @@ -1,3 +1,5 @@ +use std::mem; + use rustc_index::IndexVec; use rustc_middle::mir::tcx::{PlaceTy, RvalueInitializationState}; use rustc_middle::mir::*; @@ -6,12 +8,10 @@ use rustc_middle::{bug, span_bug}; use smallvec::{smallvec, SmallVec}; use tracing::debug; -use std::mem; - use super::abs_domain::Lift; -use super::{Init, InitIndex, InitKind, InitLocation, LookupResult}; use super::{ - LocationMap, MoveData, MoveOut, MoveOutIndex, MovePath, MovePathIndex, MovePathLookup, + Init, InitIndex, InitKind, InitLocation, LocationMap, LookupResult, MoveData, MoveOut, + MoveOutIndex, MovePath, MovePathIndex, MovePathLookup, }; struct MoveDataBuilder<'a, 'tcx, F> { diff --git a/compiler/rustc_mir_dataflow/src/move_paths/mod.rs b/compiler/rustc_mir_dataflow/src/move_paths/mod.rs index 830f44df5fb..bc1177976b5 100644 --- a/compiler/rustc_mir_dataflow/src/move_paths/mod.rs +++ b/compiler/rustc_mir_dataflow/src/move_paths/mod.rs @@ -1,4 +1,6 @@ -use crate::un_derefer::UnDerefer; +use std::fmt; +use std::ops::{Index, IndexMut}; + use rustc_data_structures::fx::FxHashMap; use rustc_index::{IndexSlice, IndexVec}; use rustc_middle::mir::*; @@ -6,10 +8,8 @@ use rustc_middle::ty::{ParamEnv, Ty, TyCtxt}; use rustc_span::Span; use smallvec::SmallVec; -use std::fmt; -use std::ops::{Index, IndexMut}; - use self::abs_domain::{AbstractElem, Lift}; +use crate::un_derefer::UnDerefer; mod abs_domain; diff --git a/compiler/rustc_mir_dataflow/src/points.rs b/compiler/rustc_mir_dataflow/src/points.rs index bbfb37d2a82..4be7492366a 100644 --- a/compiler/rustc_mir_dataflow/src/points.rs +++ b/compiler/rustc_mir_dataflow/src/points.rs @@ -1,10 +1,10 @@ -use crate::framework::{visit_results, ResultsVisitable, ResultsVisitor}; use rustc_index::bit_set::BitSet; use rustc_index::interval::SparseIntervalMatrix; -use rustc_index::Idx; -use rustc_index::IndexVec; +use rustc_index::{Idx, IndexVec}; use rustc_middle::mir::{self, BasicBlock, Body, Location}; +use crate::framework::{visit_results, ResultsVisitable, ResultsVisitor}; + /// Maps between a `Location` and a `PointIndex` (and vice versa). pub struct DenseLocationMap { /// For each basic block, how many points are contained within? diff --git a/compiler/rustc_mir_dataflow/src/rustc_peek.rs b/compiler/rustc_mir_dataflow/src/rustc_peek.rs index 1de9055273b..23bf35b30ca 100644 --- a/compiler/rustc_mir_dataflow/src/rustc_peek.rs +++ b/compiler/rustc_mir_dataflow/src/rustc_peek.rs @@ -1,3 +1,12 @@ +use rustc_ast::MetaItem; +use rustc_hir::def_id::DefId; +use rustc_index::bit_set::BitSet; +use rustc_middle::mir::{self, Body, Local, Location, MirPass}; +use rustc_middle::ty::{self, Ty, TyCtxt}; +use rustc_span::symbol::{sym, Symbol}; +use rustc_span::Span; +use tracing::{debug, info}; + use crate::errors::{ PeekArgumentNotALocal, PeekArgumentUntracked, PeekBitNotSet, PeekMustBeNotTemporary, PeekMustBePlaceOrRefPlace, StopAfterDataFlowEndedCompilation, @@ -6,19 +15,8 @@ use crate::framework::BitSetExt; use crate::impls::{ DefinitelyInitializedPlaces, MaybeInitializedPlaces, MaybeLiveLocals, MaybeUninitializedPlaces, }; -use crate::move_paths::{HasMoveData, MoveData}; -use crate::move_paths::{LookupResult, MovePathIndex}; -use crate::MoveDataParamEnv; -use crate::{Analysis, JoinSemiLattice, ResultsCursor}; -use rustc_ast::MetaItem; -use rustc_hir::def_id::DefId; -use rustc_index::bit_set::BitSet; -use rustc_middle::mir::MirPass; -use rustc_middle::mir::{self, Body, Local, Location}; -use rustc_middle::ty::{self, Ty, TyCtxt}; -use rustc_span::symbol::{sym, Symbol}; -use rustc_span::Span; -use tracing::{debug, info}; +use crate::move_paths::{HasMoveData, LookupResult, MoveData, MovePathIndex}; +use crate::{Analysis, JoinSemiLattice, MoveDataParamEnv, ResultsCursor}; pub struct SanityCheck; diff --git a/compiler/rustc_mir_dataflow/src/value_analysis.rs b/compiler/rustc_mir_dataflow/src/value_analysis.rs index c9f5d38fe2c..ca8a2777045 100644 --- a/compiler/rustc_mir_dataflow/src/value_analysis.rs +++ b/compiler/rustc_mir_dataflow/src/value_analysis.rs @@ -48,10 +48,9 @@ use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_target::abi::{FieldIdx, VariantIdx}; use tracing::debug; +use crate::fmt::DebugWithContext; use crate::lattice::{HasBottom, HasTop}; -use crate::{ - fmt::DebugWithContext, Analysis, AnalysisDomain, JoinSemiLattice, SwitchIntEdgeEffects, -}; +use crate::{Analysis, AnalysisDomain, JoinSemiLattice, SwitchIntEdgeEffects}; pub trait ValueAnalysis<'tcx> { /// For each place of interest, the analysis tracks a value of the given type. |
