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_ast_lowering/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_ast_lowering/src')
| -rw-r--r-- | compiler/rustc_ast_lowering/src/asm.rs | 24 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/block.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/delegation.rs | 14 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/errors.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/expr.rs | 25 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/format.rs | 16 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/item.rs | 11 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/lib.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/lifetime_collector.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/pat.rs | 16 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/path.rs | 21 | 
11 files changed, 77 insertions, 75 deletions
| diff --git a/compiler/rustc_ast_lowering/src/asm.rs b/compiler/rustc_ast_lowering/src/asm.rs index de0874af934..ea7b8c114f4 100644 --- a/compiler/rustc_ast_lowering/src/asm.rs +++ b/compiler/rustc_ast_lowering/src/asm.rs @@ -1,13 +1,5 @@ -use crate::{ImplTraitContext, ImplTraitPosition, ParamMode, ResolverAstLoweringExt}; - -use super::errors::{ - AbiSpecifiedMultipleTimes, AttSyntaxOnlyX86, ClobberAbiNotSupported, - InlineAsmUnsupportedTarget, InvalidAbiClobberAbi, InvalidAsmTemplateModifierConst, - InvalidAsmTemplateModifierLabel, InvalidAsmTemplateModifierRegClass, - InvalidAsmTemplateModifierRegClassSub, InvalidAsmTemplateModifierSym, InvalidRegister, - InvalidRegisterClass, RegisterClassOnlyClobber, RegisterConflict, -}; -use super::LoweringContext; +use std::collections::hash_map::Entry; +use std::fmt::Write; use rustc_ast::ptr::P; use rustc_ast::*; @@ -18,8 +10,16 @@ use rustc_session::parse::feature_err; use rustc_span::symbol::kw; use rustc_span::{sym, Span}; use rustc_target::asm; -use std::collections::hash_map::Entry; -use std::fmt::Write; + +use super::errors::{ + AbiSpecifiedMultipleTimes, AttSyntaxOnlyX86, ClobberAbiNotSupported, + InlineAsmUnsupportedTarget, InvalidAbiClobberAbi, InvalidAsmTemplateModifierConst, + InvalidAsmTemplateModifierLabel, InvalidAsmTemplateModifierRegClass, + InvalidAsmTemplateModifierRegClassSub, InvalidAsmTemplateModifierSym, InvalidRegister, + InvalidRegisterClass, RegisterClassOnlyClobber, RegisterConflict, +}; +use super::LoweringContext; +use crate::{ImplTraitContext, ImplTraitPosition, ParamMode, ResolverAstLoweringExt}; impl<'a, 'hir> LoweringContext<'a, 'hir> { #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable diff --git a/compiler/rustc_ast_lowering/src/block.rs b/compiler/rustc_ast_lowering/src/block.rs index e821a08bf18..9d2b5690c23 100644 --- a/compiler/rustc_ast_lowering/src/block.rs +++ b/compiler/rustc_ast_lowering/src/block.rs @@ -1,9 +1,9 @@ -use crate::{ImplTraitContext, ImplTraitPosition, LoweringContext}; use rustc_ast::{Block, BlockCheckMode, Local, LocalKind, Stmt, StmtKind}; use rustc_hir as hir; - use smallvec::SmallVec; +use crate::{ImplTraitContext, ImplTraitPosition, LoweringContext}; + impl<'a, 'hir> LoweringContext<'a, 'hir> { pub(super) fn lower_block( &mut self, diff --git a/compiler/rustc_ast_lowering/src/delegation.rs b/compiler/rustc_ast_lowering/src/delegation.rs index 6df2c15ce60..378d98e5c34 100644 --- a/compiler/rustc_ast_lowering/src/delegation.rs +++ b/compiler/rustc_ast_lowering/src/delegation.rs @@ -36,23 +36,23 @@ //! In case of discrepancy with callee function the `NotSupportedDelegation` error will //! also be emitted during HIR ty lowering. -use crate::{ImplTraitPosition, ResolverAstLoweringExt}; - -use super::{ImplTraitContext, LoweringContext, ParamMode, ParenthesizedGenericArgs}; +use std::iter; use ast::visit::Visitor; use hir::def::{DefKind, PartialRes, Res}; use hir::{BodyId, HirId}; -use rustc_ast as ast; use rustc_ast::*; use rustc_errors::ErrorGuaranteed; -use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_middle::span_bug; use rustc_middle::ty::{Asyncness, ResolverAstLowering}; -use rustc_span::{symbol::Ident, Span}; +use rustc_span::symbol::Ident; +use rustc_span::Span; use rustc_target::spec::abi; -use std::iter; +use {rustc_ast as ast, rustc_hir as hir}; + +use super::{ImplTraitContext, LoweringContext, ParamMode, ParenthesizedGenericArgs}; +use crate::{ImplTraitPosition, ResolverAstLoweringExt}; pub(crate) struct DelegationResults<'hir> { pub body_id: hir::BodyId, diff --git a/compiler/rustc_ast_lowering/src/errors.rs b/compiler/rustc_ast_lowering/src/errors.rs index 4c77892a6b7..7a6c9d8d0d3 100644 --- a/compiler/rustc_ast_lowering/src/errors.rs +++ b/compiler/rustc_ast_lowering/src/errors.rs @@ -1,8 +1,8 @@ -use rustc_errors::{ - codes::*, Diag, DiagArgFromDisplay, EmissionGuarantee, SubdiagMessageOp, Subdiagnostic, -}; +use rustc_errors::codes::*; +use rustc_errors::{Diag, DiagArgFromDisplay, EmissionGuarantee, SubdiagMessageOp, Subdiagnostic}; use rustc_macros::{Diagnostic, Subdiagnostic}; -use rustc_span::{symbol::Ident, Span, Symbol}; +use rustc_span::symbol::Ident; +use rustc_span::{Span, Symbol}; #[derive(Diagnostic)] #[diag(ast_lowering_generic_type_with_parentheses, code = E0214)] diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs index d870f9fe0ae..124fe6bd380 100644 --- a/compiler/rustc_ast_lowering/src/expr.rs +++ b/compiler/rustc_ast_lowering/src/expr.rs @@ -1,15 +1,5 @@ use std::assert_matches::assert_matches; -use super::errors::{ - AsyncCoroutinesNotSupported, AwaitOnlyInAsyncFnAndBlocks, BaseExpressionDoubleDot, - ClosureCannotBeStatic, CoroutineTooManyParameters, - FunctionalRecordUpdateDestructuringAssignment, InclusiveRangeWithNoEnd, MatchArmWithNoBody, - NeverPatternWithBody, NeverPatternWithGuard, UnderscoreExprLhsAssign, -}; -use super::ResolverAstLoweringExt; -use super::{ImplTraitContext, LoweringContext, ParamMode, ParenthesizedGenericArgs}; -use crate::errors::YieldInClosure; -use crate::{FnDeclKind, ImplTraitPosition}; use rustc_ast::ptr::P as AstP; use rustc_ast::*; use rustc_data_structures::stack::ensure_sufficient_stack; @@ -20,10 +10,21 @@ use rustc_middle::span_bug; use rustc_session::errors::report_lit_error; use rustc_span::source_map::{respan, Spanned}; use rustc_span::symbol::{kw, sym, Ident, Symbol}; -use rustc_span::DUMMY_SP; -use rustc_span::{DesugaringKind, Span}; +use rustc_span::{DesugaringKind, Span, DUMMY_SP}; use thin_vec::{thin_vec, ThinVec}; +use super::errors::{ + AsyncCoroutinesNotSupported, AwaitOnlyInAsyncFnAndBlocks, BaseExpressionDoubleDot, + ClosureCannotBeStatic, CoroutineTooManyParameters, + FunctionalRecordUpdateDestructuringAssignment, InclusiveRangeWithNoEnd, MatchArmWithNoBody, + NeverPatternWithBody, NeverPatternWithGuard, UnderscoreExprLhsAssign, +}; +use super::{ + ImplTraitContext, LoweringContext, ParamMode, ParenthesizedGenericArgs, ResolverAstLoweringExt, +}; +use crate::errors::YieldInClosure; +use crate::{FnDeclKind, ImplTraitPosition}; + impl<'hir> LoweringContext<'_, 'hir> { fn lower_exprs(&mut self, exprs: &[AstP<Expr>]) -> &'hir [hir::Expr<'hir>] { self.arena.alloc_from_iter(exprs.iter().map(|x| self.lower_expr_mut(x))) diff --git a/compiler/rustc_ast_lowering/src/format.rs b/compiler/rustc_ast_lowering/src/format.rs index ca4604c60c5..bf40c9b66c6 100644 --- a/compiler/rustc_ast_lowering/src/format.rs +++ b/compiler/rustc_ast_lowering/src/format.rs @@ -1,16 +1,14 @@ -use super::LoweringContext; use core::ops::ControlFlow; -use rustc_ast as ast; +use std::borrow::Cow; + use rustc_ast::visit::Visitor; use rustc_ast::*; use rustc_data_structures::fx::FxIndexMap; -use rustc_hir as hir; -use rustc_span::{ - sym, - symbol::{kw, Ident}, - Span, Symbol, -}; -use std::borrow::Cow; +use rustc_span::symbol::{kw, Ident}; +use rustc_span::{sym, Span, Symbol}; +use {rustc_ast as ast, rustc_hir as hir}; + +use super::LoweringContext; impl<'hir> LoweringContext<'_, 'hir> { pub(crate) fn lower_format_args(&mut self, sp: Span, fmt: &FormatArgs) -> hir::ExprKind<'hir> { diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index 6e6aac1ddfc..1456890a0a2 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -1,8 +1,3 @@ -use super::errors::{InvalidAbi, InvalidAbiReason, InvalidAbiSuggestion, MisplacedRelaxTraitBound}; -use super::ResolverAstLoweringExt; -use super::{AstOwner, ImplTraitContext, ImplTraitPosition}; -use super::{FnDeclKind, LoweringContext, ParamMode}; - use rustc_ast::ptr::P; use rustc_ast::visit::AssocCtxt; use rustc_ast::*; @@ -22,6 +17,12 @@ use smallvec::{smallvec, SmallVec}; use thin_vec::ThinVec; use tracing::instrument; +use super::errors::{InvalidAbi, InvalidAbiReason, InvalidAbiSuggestion, MisplacedRelaxTraitBound}; +use super::{ + AstOwner, FnDeclKind, ImplTraitContext, ImplTraitPosition, LoweringContext, ParamMode, + ResolverAstLoweringExt, +}; + pub(super) struct ItemLowerer<'a, 'hir> { pub(super) tcx: TyCtxt<'hir>, pub(super) resolver: &'a mut ResolverAstLowering, diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index d44f953010a..224787c335b 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -39,7 +39,8 @@ #![feature(rustdoc_internals)] // tidy-alphabetical-end -use crate::errors::{AssocTyParentheses, AssocTyParenthesesSub, MisplacedImplTrait}; +use std::collections::hash_map::Entry; + use rustc_ast::node_id::NodeMap; use rustc_ast::ptr::P; use rustc_ast::{self as ast, *}; @@ -53,9 +54,9 @@ use rustc_data_structures::sync::Lrc; use rustc_errors::{DiagArgFromDisplay, DiagCtxtHandle, StashKey}; use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res}; use rustc_hir::def_id::{LocalDefId, LocalDefIdMap, CRATE_DEF_ID, LOCAL_CRATE}; -use rustc_hir::{self as hir}; use rustc_hir::{ - ConstArg, GenericArg, HirId, ItemLocalMap, MissingLifetimeKind, ParamName, TraitCandidate, + self as hir, ConstArg, GenericArg, HirId, ItemLocalMap, MissingLifetimeKind, ParamName, + TraitCandidate, }; use rustc_index::{Idx, IndexSlice, IndexVec}; use rustc_macros::extension; @@ -65,10 +66,11 @@ use rustc_session::parse::{add_feature_diagnostics, feature_err}; use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::{DesugaringKind, Span, DUMMY_SP}; use smallvec::{smallvec, SmallVec}; -use std::collections::hash_map::Entry; use thin_vec::ThinVec; use tracing::{debug, instrument, trace}; +use crate::errors::{AssocTyParentheses, AssocTyParenthesesSub, MisplacedImplTrait}; + macro_rules! arena_vec { ($this:expr; $($x:expr),*) => ( $this.arena.alloc_from_iter([$($x),*]) diff --git a/compiler/rustc_ast_lowering/src/lifetime_collector.rs b/compiler/rustc_ast_lowering/src/lifetime_collector.rs index 5456abd489b..77cc2a36a53 100644 --- a/compiler/rustc_ast_lowering/src/lifetime_collector.rs +++ b/compiler/rustc_ast_lowering/src/lifetime_collector.rs @@ -1,4 +1,3 @@ -use super::ResolverAstLoweringExt; use rustc_ast::visit::{self, BoundKind, LifetimeCtxt, Visitor}; use rustc_ast::{GenericBounds, Lifetime, NodeId, PathSegment, PolyTraitRef, Ty, TyKind}; use rustc_data_structures::fx::FxIndexSet; @@ -8,6 +7,8 @@ use rustc_middle::ty::ResolverAstLowering; use rustc_span::symbol::{kw, Ident}; use rustc_span::Span; +use super::ResolverAstLoweringExt; + struct LifetimeCollectVisitor<'ast> { resolver: &'ast ResolverAstLowering, current_binders: Vec<NodeId>, diff --git a/compiler/rustc_ast_lowering/src/pat.rs b/compiler/rustc_ast_lowering/src/pat.rs index 32de07a0755..d82bdd526b7 100644 --- a/compiler/rustc_ast_lowering/src/pat.rs +++ b/compiler/rustc_ast_lowering/src/pat.rs @@ -1,17 +1,17 @@ -use super::errors::{ - ArbitraryExpressionInPattern, ExtraDoubleDot, MisplacedDoubleDot, SubTupleBinding, -}; -use super::ResolverAstLoweringExt; -use super::{ImplTraitContext, LoweringContext, ParamMode}; -use crate::ImplTraitPosition; - use rustc_ast::ptr::P; use rustc_ast::*; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_hir as hir; use rustc_hir::def::Res; +use rustc_span::source_map::Spanned; use rustc_span::symbol::Ident; -use rustc_span::{source_map::Spanned, Span}; +use rustc_span::Span; + +use super::errors::{ + ArbitraryExpressionInPattern, ExtraDoubleDot, MisplacedDoubleDot, SubTupleBinding, +}; +use super::{ImplTraitContext, LoweringContext, ParamMode, ResolverAstLoweringExt}; +use crate::ImplTraitPosition; impl<'a, 'hir> LoweringContext<'a, 'hir> { pub(crate) fn lower_pat(&mut self, pattern: &Pat) -> &'hir hir::Pat<'hir> { diff --git a/compiler/rustc_ast_lowering/src/path.rs b/compiler/rustc_ast_lowering/src/path.rs index ac36b074609..077b06acd7c 100644 --- a/compiler/rustc_ast_lowering/src/path.rs +++ b/compiler/rustc_ast_lowering/src/path.rs @@ -1,13 +1,3 @@ -use crate::ImplTraitPosition; - -use super::errors::{ - AsyncBoundNotOnTrait, AsyncBoundOnlyForFnTraits, BadReturnTypeNotation, - GenericTypeWithParentheses, UseAngleBrackets, -}; -use super::ResolverAstLoweringExt; -use super::{GenericArgsCtor, LifetimeRes, ParenthesizedGenericArgs}; -use super::{ImplTraitContext, LoweringContext, ParamMode}; - use rustc_ast::{self as ast, *}; use rustc_data_structures::sync::Lrc; use rustc_hir as hir; @@ -17,10 +7,19 @@ use rustc_hir::GenericArg; use rustc_middle::span_bug; use rustc_span::symbol::{kw, sym, Ident}; use rustc_span::{BytePos, DesugaringKind, Span, Symbol, DUMMY_SP}; - use smallvec::{smallvec, SmallVec}; use tracing::{debug, instrument}; +use super::errors::{ + AsyncBoundNotOnTrait, AsyncBoundOnlyForFnTraits, BadReturnTypeNotation, + GenericTypeWithParentheses, UseAngleBrackets, +}; +use super::{ + GenericArgsCtor, ImplTraitContext, LifetimeRes, LoweringContext, ParamMode, + ParenthesizedGenericArgs, ResolverAstLoweringExt, +}; +use crate::ImplTraitPosition; + impl<'a, 'hir> LoweringContext<'a, 'hir> { #[instrument(level = "trace", skip(self))] pub(crate) fn lower_qpath( | 
