diff --git a/src/librustc_ast/lib.rs b/src/librustc_ast/lib.rs index fb5ce31182627..b556c1a446b7b 100644 --- a/src/librustc_ast/lib.rs +++ b/src/librustc_ast/lib.rs @@ -51,6 +51,8 @@ pub mod token; pub mod tokenstream; pub mod visit; +pub use self::ast::*; + use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; /// Requirements for a `StableHashingContext` to be used in this crate. diff --git a/src/librustc_ast_lowering/expr.rs b/src/librustc_ast_lowering/expr.rs index f9e54903a661a..d76b30d6c110e 100644 --- a/src/librustc_ast_lowering/expr.rs +++ b/src/librustc_ast_lowering/expr.rs @@ -1,8 +1,8 @@ use super::{ImplTraitContext, LoweringContext, ParamMode, ParenthesizedGenericArgs}; -use rustc_ast::ast::*; use rustc_ast::attr; use rustc_ast::ptr::P as AstP; +use rustc_ast::*; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_data_structures::thin_vec::ThinVec; @@ -861,7 +861,7 @@ impl<'hir> LoweringContext<'_, 'hir> { e2: Option<&Expr>, lims: RangeLimits, ) -> hir::ExprKind<'hir> { - use rustc_ast::ast::RangeLimits::*; + use rustc_ast::RangeLimits::*; let path = match (e1, e2, lims) { (None, None, HalfOpen) => sym::RangeFull, diff --git a/src/librustc_ast_lowering/item.rs b/src/librustc_ast_lowering/item.rs index 699f5c9778a2f..473fb7ccc70c4 100644 --- a/src/librustc_ast_lowering/item.rs +++ b/src/librustc_ast_lowering/item.rs @@ -2,10 +2,10 @@ use super::{AnonymousLifetimeMode, LoweringContext, ParamMode}; use super::{ImplTraitContext, ImplTraitPosition}; use crate::Arena; -use rustc_ast::ast::*; use rustc_ast::node_id::NodeMap; use rustc_ast::ptr::P; use rustc_ast::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor}; +use rustc_ast::*; use rustc_data_structures::fx::FxHashSet; use rustc_errors::struct_span_err; use rustc_hir as hir; diff --git a/src/librustc_ast_lowering/lib.rs b/src/librustc_ast_lowering/lib.rs index 7cfde3fc6d2dc..f2ab7d2e0b4e3 100644 --- a/src/librustc_ast_lowering/lib.rs +++ b/src/librustc_ast_lowering/lib.rs @@ -35,13 +35,12 @@ #![feature(or_patterns)] #![recursion_limit = "256"] -use rustc_ast::ast; -use rustc_ast::ast::*; use rustc_ast::node_id::NodeMap; use rustc_ast::token::{self, DelimToken, Nonterminal, Token}; use rustc_ast::tokenstream::{DelimSpan, TokenStream, TokenTree}; use rustc_ast::visit::{self, AssocCtxt, Visitor}; use rustc_ast::walk_list; +use rustc_ast::{self as ast, *}; use rustc_ast_pretty::pprust; use rustc_data_structures::captures::Captures; use rustc_data_structures::fx::FxHashSet; diff --git a/src/librustc_ast_lowering/pat.rs b/src/librustc_ast_lowering/pat.rs index 171856e7e6371..cb7b7c0eb6116 100644 --- a/src/librustc_ast_lowering/pat.rs +++ b/src/librustc_ast_lowering/pat.rs @@ -1,7 +1,7 @@ use super::{ImplTraitContext, LoweringContext, ParamMode}; -use rustc_ast::ast::*; use rustc_ast::ptr::P; +use rustc_ast::*; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_errors::Applicability; use rustc_hir as hir; diff --git a/src/librustc_ast_lowering/path.rs b/src/librustc_ast_lowering/path.rs index 2541d6824fec4..cf68dfb9ae1a1 100644 --- a/src/librustc_ast_lowering/path.rs +++ b/src/librustc_ast_lowering/path.rs @@ -1,7 +1,7 @@ use super::{AnonymousLifetimeMode, ImplTraitContext, LoweringContext, ParamMode}; use super::{GenericArgsCtor, ParenthesizedGenericArgs}; -use rustc_ast::ast::{self, *}; +use rustc_ast::{self as ast, *}; use rustc_errors::{struct_span_err, Applicability}; use rustc_hir as hir; use rustc_hir::def::{DefKind, PartialRes, Res}; diff --git a/src/librustc_ast_passes/ast_validation.rs b/src/librustc_ast_passes/ast_validation.rs index 3c2a063cf2481..a01dd8c939cf6 100644 --- a/src/librustc_ast_passes/ast_validation.rs +++ b/src/librustc_ast_passes/ast_validation.rs @@ -7,10 +7,10 @@ // or type checking or some other kind of complex analysis. use itertools::{Either, Itertools}; -use rustc_ast::ast::*; use rustc_ast::ptr::P; use rustc_ast::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor}; use rustc_ast::walk_list; +use rustc_ast::*; use rustc_ast_pretty::pprust; use rustc_data_structures::fx::FxHashMap; use rustc_errors::{error_code, pluralize, struct_span_err, Applicability}; diff --git a/src/librustc_ast_passes/feature_gate.rs b/src/librustc_ast_passes/feature_gate.rs index ce39ceff8f389..b15792dfd4c45 100644 --- a/src/librustc_ast_passes/feature_gate.rs +++ b/src/librustc_ast_passes/feature_gate.rs @@ -1,6 +1,7 @@ -use rustc_ast::ast::{self, AssocTyConstraint, AssocTyConstraintKind, NodeId}; -use rustc_ast::ast::{GenericParam, GenericParamKind, PatKind, RangeEnd, VariantData}; +use rustc_ast as ast; use rustc_ast::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor}; +use rustc_ast::{AssocTyConstraint, AssocTyConstraintKind, NodeId}; +use rustc_ast::{GenericParam, GenericParamKind, PatKind, RangeEnd, VariantData}; use rustc_errors::struct_span_err; use rustc_feature::{AttributeGate, BUILTIN_ATTRIBUTE_MAP}; use rustc_feature::{Features, GateIssue}; diff --git a/src/librustc_ast_passes/node_count.rs b/src/librustc_ast_passes/node_count.rs index 34db59b1b458d..706dca2b7f455 100644 --- a/src/librustc_ast_passes/node_count.rs +++ b/src/librustc_ast_passes/node_count.rs @@ -1,7 +1,7 @@ // Simply gives a rough count of the number of nodes in an AST. -use rustc_ast::ast::*; use rustc_ast::visit::*; +use rustc_ast::*; use rustc_span::symbol::Ident; use rustc_span::Span; diff --git a/src/librustc_ast_passes/show_span.rs b/src/librustc_ast_passes/show_span.rs index 2366426d4dcba..053aba8622271 100644 --- a/src/librustc_ast_passes/show_span.rs +++ b/src/librustc_ast_passes/show_span.rs @@ -5,7 +5,7 @@ use std::str::FromStr; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::visit; use rustc_ast::visit::Visitor; diff --git a/src/librustc_ast_pretty/pprust.rs b/src/librustc_ast_pretty/pprust.rs index 9d9ca78de5588..cb48deb58863e 100644 --- a/src/librustc_ast_pretty/pprust.rs +++ b/src/librustc_ast_pretty/pprust.rs @@ -1,11 +1,6 @@ use crate::pp::Breaks::{Consistent, Inconsistent}; use crate::pp::{self, Breaks}; -use rustc_ast::ast::{self, BlockCheckMode, PatKind, RangeEnd, RangeSyntax}; -use rustc_ast::ast::{Attribute, GenericArg, MacArgs}; -use rustc_ast::ast::{GenericBound, SelfKind, TraitBoundModifier}; -use rustc_ast::ast::{InlineAsmOperand, InlineAsmRegOrRegClass}; -use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use rustc_ast::attr; use rustc_ast::ptr::P; use rustc_ast::token::{self, BinOpToken, CommentKind, DelimToken, Nonterminal, Token, TokenKind}; @@ -13,6 +8,11 @@ use rustc_ast::tokenstream::{TokenStream, TokenTree}; use rustc_ast::util::classify; use rustc_ast::util::comments::{gather_comments, Comment, CommentStyle}; use rustc_ast::util::parser::{self, AssocOp, Fixity}; +use rustc_ast::{self as ast, BlockCheckMode, PatKind, RangeEnd, RangeSyntax}; +use rustc_ast::{GenericArg, MacArgs}; +use rustc_ast::{GenericBound, SelfKind, TraitBoundModifier}; +use rustc_ast::{InlineAsmOperand, InlineAsmRegOrRegClass}; +use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use rustc_span::edition::Edition; use rustc_span::source_map::{SourceMap, Spanned}; use rustc_span::symbol::{kw, sym, Ident, IdentPrinter, Symbol}; @@ -902,7 +902,7 @@ impl<'a> State<'a> { } } - crate fn print_foreign_mod(&mut self, nmod: &ast::ForeignMod, attrs: &[Attribute]) { + crate fn print_foreign_mod(&mut self, nmod: &ast::ForeignMod, attrs: &[ast::Attribute]) { self.print_inner_attributes(attrs); for item in &nmod.items { self.print_foreign_item(item); @@ -1666,7 +1666,7 @@ impl<'a> State<'a> { } } - fn print_expr_vec(&mut self, exprs: &[P], attrs: &[Attribute]) { + fn print_expr_vec(&mut self, exprs: &[P], attrs: &[ast::Attribute]) { self.ibox(INDENT_UNIT); self.s.word("["); self.print_inner_attributes_inline(attrs); @@ -1679,7 +1679,7 @@ impl<'a> State<'a> { &mut self, element: &ast::Expr, count: &ast::AnonConst, - attrs: &[Attribute], + attrs: &[ast::Attribute], ) { self.ibox(INDENT_UNIT); self.s.word("["); @@ -1696,7 +1696,7 @@ impl<'a> State<'a> { path: &ast::Path, fields: &[ast::Field], wth: &Option>, - attrs: &[Attribute], + attrs: &[ast::Attribute], ) { self.print_path(path, true, 0); self.s.word("{"); @@ -1736,7 +1736,7 @@ impl<'a> State<'a> { self.s.word("}"); } - fn print_expr_tup(&mut self, exprs: &[P], attrs: &[Attribute]) { + fn print_expr_tup(&mut self, exprs: &[P], attrs: &[ast::Attribute]) { self.popen(); self.print_inner_attributes_inline(attrs); self.commasep_exprs(Inconsistent, &exprs[..]); diff --git a/src/librustc_ast_pretty/pprust/tests.rs b/src/librustc_ast_pretty/pprust/tests.rs index fdbd073255e83..fdbf3feb900ef 100644 --- a/src/librustc_ast_pretty/pprust/tests.rs +++ b/src/librustc_ast_pretty/pprust/tests.rs @@ -1,6 +1,6 @@ use super::*; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_span::source_map::respan; use rustc_span::symbol::Ident; use rustc_span::with_default_session_globals; diff --git a/src/librustc_attr/builtin.rs b/src/librustc_attr/builtin.rs index 3ddabcc17f8b6..b8929fe088913 100644 --- a/src/librustc_attr/builtin.rs +++ b/src/librustc_attr/builtin.rs @@ -1,6 +1,6 @@ //! Parsing and validation of builtin attributes -use rustc_ast::ast::{self, Attribute, Lit, LitKind, MetaItem, MetaItemKind, NestedMetaItem}; +use rustc_ast::{self as ast, Attribute, Lit, LitKind, MetaItem, MetaItemKind, NestedMetaItem}; use rustc_ast_pretty::pprust; use rustc_errors::{struct_span_err, Applicability}; use rustc_feature::{find_gated_cfg, is_builtin_attr_name, Features, GatedCfg}; diff --git a/src/librustc_builtin_macros/asm.rs b/src/librustc_builtin_macros/asm.rs index 52f86aa7e06b9..5dafd6b77ab1e 100644 --- a/src/librustc_builtin_macros/asm.rs +++ b/src/librustc_builtin_macros/asm.rs @@ -1,4 +1,4 @@ -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::ptr::P; use rustc_ast::token; use rustc_ast::tokenstream::TokenStream; diff --git a/src/librustc_builtin_macros/assert.rs b/src/librustc_builtin_macros/assert.rs index 166cd62835030..2518171554073 100644 --- a/src/librustc_builtin_macros/assert.rs +++ b/src/librustc_builtin_macros/assert.rs @@ -1,9 +1,9 @@ use rustc_errors::{Applicability, DiagnosticBuilder}; -use rustc_ast::ast::{self, *}; use rustc_ast::ptr::P; use rustc_ast::token::{self, TokenKind}; use rustc_ast::tokenstream::{DelimSpan, TokenStream, TokenTree}; +use rustc_ast::{self as ast, *}; use rustc_ast_pretty::pprust; use rustc_expand::base::*; use rustc_parse::parser::Parser; diff --git a/src/librustc_builtin_macros/cfg.rs b/src/librustc_builtin_macros/cfg.rs index 0247ca3299158..4c00162b556b8 100644 --- a/src/librustc_builtin_macros/cfg.rs +++ b/src/librustc_builtin_macros/cfg.rs @@ -2,7 +2,7 @@ //! a literal `true` or `false` based on whether the given cfg matches the //! current compilation environment. -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::token; use rustc_ast::tokenstream::TokenStream; use rustc_attr as attr; diff --git a/src/librustc_builtin_macros/cfg_accessible.rs b/src/librustc_builtin_macros/cfg_accessible.rs index 7a91dde5a9d8a..75f4b077640d4 100644 --- a/src/librustc_builtin_macros/cfg_accessible.rs +++ b/src/librustc_builtin_macros/cfg_accessible.rs @@ -1,6 +1,6 @@ //! Implementation of the `#[cfg_accessible(path)]` attribute macro. -use rustc_ast::ast; +use rustc_ast as ast; use rustc_expand::base::{Annotatable, ExpandResult, ExtCtxt, MultiItemModifier}; use rustc_feature::AttributeTemplate; use rustc_parse::validate_attr; diff --git a/src/librustc_builtin_macros/cmdline_attrs.rs b/src/librustc_builtin_macros/cmdline_attrs.rs index 093815dbbcd4f..34e2accc61541 100644 --- a/src/librustc_builtin_macros/cmdline_attrs.rs +++ b/src/librustc_builtin_macros/cmdline_attrs.rs @@ -1,8 +1,8 @@ //! Attributes injected into the crate root from command line using `-Z crate-attr`. -use rustc_ast::ast::{self, AttrItem, AttrStyle}; use rustc_ast::attr::mk_attr; use rustc_ast::token; +use rustc_ast::{self as ast, AttrItem, AttrStyle}; use rustc_session::parse::ParseSess; use rustc_span::FileName; diff --git a/src/librustc_builtin_macros/concat.rs b/src/librustc_builtin_macros/concat.rs index 4980ba0d9d30d..e5077d93674a1 100644 --- a/src/librustc_builtin_macros/concat.rs +++ b/src/librustc_builtin_macros/concat.rs @@ -1,4 +1,4 @@ -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::tokenstream::TokenStream; use rustc_expand::base::{self, DummyResult}; use rustc_span::symbol::Symbol; diff --git a/src/librustc_builtin_macros/concat_idents.rs b/src/librustc_builtin_macros/concat_idents.rs index fdf05ac3880b5..8223cdda07231 100644 --- a/src/librustc_builtin_macros/concat_idents.rs +++ b/src/librustc_builtin_macros/concat_idents.rs @@ -1,4 +1,4 @@ -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::ptr::P; use rustc_ast::token::{self, Token}; use rustc_ast::tokenstream::{TokenStream, TokenTree}; diff --git a/src/librustc_builtin_macros/deriving/bounds.rs b/src/librustc_builtin_macros/deriving/bounds.rs index cef0da60a61c8..12ef166b8b051 100644 --- a/src/librustc_builtin_macros/deriving/bounds.rs +++ b/src/librustc_builtin_macros/deriving/bounds.rs @@ -2,7 +2,7 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::path_std; -use rustc_ast::ast::MetaItem; +use rustc_ast::MetaItem; use rustc_expand::base::{Annotatable, ExtCtxt}; use rustc_span::Span; diff --git a/src/librustc_builtin_macros/deriving/clone.rs b/src/librustc_builtin_macros/deriving/clone.rs index b307ee26c91d5..957c8035399a2 100644 --- a/src/librustc_builtin_macros/deriving/clone.rs +++ b/src/librustc_builtin_macros/deriving/clone.rs @@ -2,8 +2,8 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::path_std; -use rustc_ast::ast::{self, Expr, GenericArg, Generics, ItemKind, MetaItem, VariantData}; use rustc_ast::ptr::P; +use rustc_ast::{self as ast, Expr, GenericArg, Generics, ItemKind, MetaItem, VariantData}; use rustc_expand::base::{Annotatable, ExtCtxt}; use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::Span; diff --git a/src/librustc_builtin_macros/deriving/cmp/eq.rs b/src/librustc_builtin_macros/deriving/cmp/eq.rs index d1b799cd6a112..79f35ad5819f1 100644 --- a/src/librustc_builtin_macros/deriving/cmp/eq.rs +++ b/src/librustc_builtin_macros/deriving/cmp/eq.rs @@ -2,8 +2,8 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::path_std; -use rustc_ast::ast::{self, Expr, GenericArg, MetaItem}; use rustc_ast::ptr::P; +use rustc_ast::{self as ast, Expr, GenericArg, MetaItem}; use rustc_expand::base::{Annotatable, ExtCtxt}; use rustc_span::symbol::{sym, Ident, Symbol}; use rustc_span::Span; diff --git a/src/librustc_builtin_macros/deriving/cmp/ord.rs b/src/librustc_builtin_macros/deriving/cmp/ord.rs index 3bf3860d32307..c1473e2409332 100644 --- a/src/librustc_builtin_macros/deriving/cmp/ord.rs +++ b/src/librustc_builtin_macros/deriving/cmp/ord.rs @@ -2,8 +2,8 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::path_std; -use rustc_ast::ast::{self, Expr, MetaItem}; use rustc_ast::ptr::P; +use rustc_ast::{self as ast, Expr, MetaItem}; use rustc_expand::base::{Annotatable, ExtCtxt}; use rustc_span::symbol::{sym, Ident}; use rustc_span::Span; diff --git a/src/librustc_builtin_macros/deriving/cmp/partial_eq.rs b/src/librustc_builtin_macros/deriving/cmp/partial_eq.rs index d8edd641acd52..8e9f15743cc34 100644 --- a/src/librustc_builtin_macros/deriving/cmp/partial_eq.rs +++ b/src/librustc_builtin_macros/deriving/cmp/partial_eq.rs @@ -2,8 +2,8 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::{path_local, path_std}; -use rustc_ast::ast::{BinOpKind, Expr, MetaItem}; use rustc_ast::ptr::P; +use rustc_ast::{BinOpKind, Expr, MetaItem}; use rustc_expand::base::{Annotatable, ExtCtxt}; use rustc_span::symbol::sym; use rustc_span::Span; diff --git a/src/librustc_builtin_macros/deriving/cmp/partial_ord.rs b/src/librustc_builtin_macros/deriving/cmp/partial_ord.rs index 39a747c856839..21174ca4c8bf9 100644 --- a/src/librustc_builtin_macros/deriving/cmp/partial_ord.rs +++ b/src/librustc_builtin_macros/deriving/cmp/partial_ord.rs @@ -4,8 +4,8 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::{path_local, path_std, pathvec_std}; -use rustc_ast::ast::{self, BinOpKind, Expr, MetaItem}; use rustc_ast::ptr::P; +use rustc_ast::{self as ast, BinOpKind, Expr, MetaItem}; use rustc_expand::base::{Annotatable, ExtCtxt}; use rustc_span::symbol::{sym, Ident, Symbol}; use rustc_span::Span; diff --git a/src/librustc_builtin_macros/deriving/debug.rs b/src/librustc_builtin_macros/deriving/debug.rs index 76e21bc43c52d..120e859f2b1a4 100644 --- a/src/librustc_builtin_macros/deriving/debug.rs +++ b/src/librustc_builtin_macros/deriving/debug.rs @@ -2,9 +2,8 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::path_std; -use rustc_ast::ast; -use rustc_ast::ast::{Expr, MetaItem}; use rustc_ast::ptr::P; +use rustc_ast::{self as ast, Expr, MetaItem}; use rustc_expand::base::{Annotatable, ExtCtxt}; use rustc_span::symbol::{sym, Ident}; use rustc_span::{Span, DUMMY_SP}; diff --git a/src/librustc_builtin_macros/deriving/decodable.rs b/src/librustc_builtin_macros/deriving/decodable.rs index ce8c2dfe4d5a0..df69f6c90d813 100644 --- a/src/librustc_builtin_macros/deriving/decodable.rs +++ b/src/librustc_builtin_macros/deriving/decodable.rs @@ -4,9 +4,8 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::pathvec_std; -use rustc_ast::ast; -use rustc_ast::ast::{Expr, MetaItem, Mutability}; use rustc_ast::ptr::P; +use rustc_ast::{self as ast, Expr, MetaItem, Mutability}; use rustc_expand::base::{Annotatable, ExtCtxt}; use rustc_span::symbol::{sym, Ident, Symbol}; use rustc_span::Span; diff --git a/src/librustc_builtin_macros/deriving/default.rs b/src/librustc_builtin_macros/deriving/default.rs index 2611855a3a1b5..980be3a005039 100644 --- a/src/librustc_builtin_macros/deriving/default.rs +++ b/src/librustc_builtin_macros/deriving/default.rs @@ -1,8 +1,8 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; -use rustc_ast::ast::{Expr, MetaItem}; use rustc_ast::ptr::P; +use rustc_ast::{Expr, MetaItem}; use rustc_errors::struct_span_err; use rustc_expand::base::{Annotatable, DummyResult, ExtCtxt}; use rustc_span::symbol::{kw, sym}; diff --git a/src/librustc_builtin_macros/deriving/encodable.rs b/src/librustc_builtin_macros/deriving/encodable.rs index 7a880357a5947..62aa1cbfbf265 100644 --- a/src/librustc_builtin_macros/deriving/encodable.rs +++ b/src/librustc_builtin_macros/deriving/encodable.rs @@ -89,8 +89,8 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::pathvec_std; -use rustc_ast::ast::{Expr, ExprKind, MetaItem, Mutability}; use rustc_ast::ptr::P; +use rustc_ast::{Expr, ExprKind, MetaItem, Mutability}; use rustc_expand::base::{Annotatable, ExtCtxt}; use rustc_span::symbol::{sym, Ident, Symbol}; use rustc_span::Span; diff --git a/src/librustc_builtin_macros/deriving/generic/mod.rs b/src/librustc_builtin_macros/deriving/generic/mod.rs index 908aabe902434..accb0b3c94965 100644 --- a/src/librustc_builtin_macros/deriving/generic/mod.rs +++ b/src/librustc_builtin_macros/deriving/generic/mod.rs @@ -181,9 +181,9 @@ use std::cell::RefCell; use std::iter; use std::vec; -use rustc_ast::ast::{self, BinOpKind, EnumDef, Expr, Generics, PatKind}; -use rustc_ast::ast::{GenericArg, GenericParamKind, VariantData}; use rustc_ast::ptr::P; +use rustc_ast::{self as ast, BinOpKind, EnumDef, Expr, Generics, PatKind}; +use rustc_ast::{GenericArg, GenericParamKind, VariantData}; use rustc_attr as attr; use rustc_data_structures::map_in_place::MapInPlace; use rustc_expand::base::{Annotatable, ExtCtxt}; diff --git a/src/librustc_builtin_macros/deriving/generic/ty.rs b/src/librustc_builtin_macros/deriving/generic/ty.rs index 51314dbcffc06..6b7d0e1f204b5 100644 --- a/src/librustc_builtin_macros/deriving/generic/ty.rs +++ b/src/librustc_builtin_macros/deriving/generic/ty.rs @@ -4,8 +4,8 @@ pub use PtrTy::*; pub use Ty::*; -use rustc_ast::ast::{self, Expr, GenericArg, GenericParamKind, Generics, SelfKind}; use rustc_ast::ptr::P; +use rustc_ast::{self as ast, Expr, GenericArg, GenericParamKind, Generics, SelfKind}; use rustc_expand::base::ExtCtxt; use rustc_span::source_map::{respan, DUMMY_SP}; use rustc_span::symbol::{kw, Ident, Symbol}; diff --git a/src/librustc_builtin_macros/deriving/hash.rs b/src/librustc_builtin_macros/deriving/hash.rs index d7195188085f0..868f863b99021 100644 --- a/src/librustc_builtin_macros/deriving/hash.rs +++ b/src/librustc_builtin_macros/deriving/hash.rs @@ -2,8 +2,8 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::{self, path_std, pathvec_std}; -use rustc_ast::ast::{Expr, MetaItem, Mutability}; use rustc_ast::ptr::P; +use rustc_ast::{Expr, MetaItem, Mutability}; use rustc_expand::base::{Annotatable, ExtCtxt}; use rustc_span::symbol::sym; use rustc_span::Span; diff --git a/src/librustc_builtin_macros/deriving/mod.rs b/src/librustc_builtin_macros/deriving/mod.rs index 33c0edde98f0b..7e3fd131d4417 100644 --- a/src/librustc_builtin_macros/deriving/mod.rs +++ b/src/librustc_builtin_macros/deriving/mod.rs @@ -1,7 +1,8 @@ //! The compiler code necessary to implement the `#[derive]` extensions. -use rustc_ast::ast::{self, ItemKind, MetaItem}; +use rustc_ast as ast; use rustc_ast::ptr::P; +use rustc_ast::{ItemKind, MetaItem}; use rustc_expand::base::{Annotatable, ExpandResult, ExtCtxt, MultiItemModifier}; use rustc_span::symbol::{sym, Ident, Symbol}; use rustc_span::Span; diff --git a/src/librustc_builtin_macros/env.rs b/src/librustc_builtin_macros/env.rs index b6f733ee93db0..6de12acfb9429 100644 --- a/src/librustc_builtin_macros/env.rs +++ b/src/librustc_builtin_macros/env.rs @@ -3,8 +3,8 @@ // interface. // -use rustc_ast::ast::{self, GenericArg}; use rustc_ast::tokenstream::TokenStream; +use rustc_ast::{self as ast, GenericArg}; use rustc_expand::base::{self, *}; use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::Span; diff --git a/src/librustc_builtin_macros/format.rs b/src/librustc_builtin_macros/format.rs index 78cead02b7b7c..373277f525d74 100644 --- a/src/librustc_builtin_macros/format.rs +++ b/src/librustc_builtin_macros/format.rs @@ -1,7 +1,7 @@ use ArgumentType::*; use Position::*; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::ptr::P; use rustc_ast::token; use rustc_ast::tokenstream::TokenStream; diff --git a/src/librustc_builtin_macros/global_allocator.rs b/src/librustc_builtin_macros/global_allocator.rs index ccff8aa90a8ad..c37adb7baa057 100644 --- a/src/librustc_builtin_macros/global_allocator.rs +++ b/src/librustc_builtin_macros/global_allocator.rs @@ -1,11 +1,11 @@ use crate::util::check_builtin_macro_attribute; -use rustc_ast::ast::{self, Attribute, Expr, FnHeader, FnSig, Generics, Param}; -use rustc_ast::ast::{ItemKind, Mutability, Stmt, Ty, TyKind, Unsafe}; use rustc_ast::expand::allocator::{ AllocatorKind, AllocatorMethod, AllocatorTy, ALLOCATOR_METHODS, }; use rustc_ast::ptr::P; +use rustc_ast::{self as ast, Attribute, Expr, FnHeader, FnSig, Generics, Param}; +use rustc_ast::{ItemKind, Mutability, Stmt, Ty, TyKind, Unsafe}; use rustc_expand::base::{Annotatable, ExtCtxt}; use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::Span; diff --git a/src/librustc_builtin_macros/global_asm.rs b/src/librustc_builtin_macros/global_asm.rs index 2729239f62b90..2465f33622e84 100644 --- a/src/librustc_builtin_macros/global_asm.rs +++ b/src/librustc_builtin_macros/global_asm.rs @@ -8,7 +8,7 @@ //! LLVM's `module asm "some assembly here"`. All of LLVM's caveats //! therefore apply. -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::ptr::P; use rustc_ast::token; use rustc_ast::tokenstream::TokenStream; diff --git a/src/librustc_builtin_macros/llvm_asm.rs b/src/librustc_builtin_macros/llvm_asm.rs index 77fd71d58ef6b..db73fdbe24ff5 100644 --- a/src/librustc_builtin_macros/llvm_asm.rs +++ b/src/librustc_builtin_macros/llvm_asm.rs @@ -2,10 +2,11 @@ // use State::*; -use rustc_ast::ast::{self, LlvmAsmDialect}; +use rustc_ast as ast; use rustc_ast::ptr::P; use rustc_ast::token::{self, Token}; use rustc_ast::tokenstream::{self, TokenStream}; +use rustc_ast::LlvmAsmDialect; use rustc_errors::{struct_span_err, DiagnosticBuilder, PResult}; use rustc_expand::base::*; use rustc_parse::parser::Parser; diff --git a/src/librustc_builtin_macros/proc_macro_harness.rs b/src/librustc_builtin_macros/proc_macro_harness.rs index 4f2f066e652f1..0c6769906f339 100644 --- a/src/librustc_builtin_macros/proc_macro_harness.rs +++ b/src/librustc_builtin_macros/proc_macro_harness.rs @@ -1,9 +1,9 @@ use std::mem; -use rustc_ast::ast::{self, NodeId}; use rustc_ast::attr; use rustc_ast::ptr::P; use rustc_ast::visit::{self, Visitor}; +use rustc_ast::{self as ast, NodeId}; use rustc_ast_pretty::pprust; use rustc_expand::base::{ExtCtxt, ResolverExpand}; use rustc_expand::expand::{AstFragment, ExpansionConfig}; diff --git a/src/librustc_builtin_macros/source_util.rs b/src/librustc_builtin_macros/source_util.rs index e46cf67e64d66..70753208af310 100644 --- a/src/librustc_builtin_macros/source_util.rs +++ b/src/librustc_builtin_macros/source_util.rs @@ -1,4 +1,4 @@ -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::ptr::P; use rustc_ast::token; use rustc_ast::tokenstream::TokenStream; diff --git a/src/librustc_builtin_macros/standard_library_imports.rs b/src/librustc_builtin_macros/standard_library_imports.rs index 52759fede75ce..e801b5c7b0c62 100644 --- a/src/librustc_builtin_macros/standard_library_imports.rs +++ b/src/librustc_builtin_macros/standard_library_imports.rs @@ -1,4 +1,4 @@ -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::ptr::P; use rustc_expand::base::{ExtCtxt, ResolverExpand}; use rustc_expand::expand::ExpansionConfig; diff --git a/src/librustc_builtin_macros/test.rs b/src/librustc_builtin_macros/test.rs index 00593c68cfc9a..8e56e80bba204 100644 --- a/src/librustc_builtin_macros/test.rs +++ b/src/librustc_builtin_macros/test.rs @@ -2,7 +2,7 @@ /// Ideally, this code would be in libtest but for efficiency and error messages it lives here. use crate::util::check_builtin_macro_attribute; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::attr; use rustc_ast_pretty::pprust; use rustc_expand::base::*; diff --git a/src/librustc_builtin_macros/test_harness.rs b/src/librustc_builtin_macros/test_harness.rs index a80763d6ec8e8..277cd8389e3e2 100644 --- a/src/librustc_builtin_macros/test_harness.rs +++ b/src/librustc_builtin_macros/test_harness.rs @@ -1,6 +1,6 @@ // Code that generates a test runner to run all the tests in a crate -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::attr; use rustc_ast::entry::EntryPointType; use rustc_ast::mut_visit::{ExpectOne, *}; diff --git a/src/librustc_builtin_macros/util.rs b/src/librustc_builtin_macros/util.rs index 3ee6cd7396440..01ea80c4c8a06 100644 --- a/src/librustc_builtin_macros/util.rs +++ b/src/librustc_builtin_macros/util.rs @@ -1,4 +1,4 @@ -use rustc_ast::ast::MetaItem; +use rustc_ast::MetaItem; use rustc_expand::base::ExtCtxt; use rustc_feature::AttributeTemplate; use rustc_parse::validate_attr; diff --git a/src/librustc_codegen_llvm/asm.rs b/src/librustc_codegen_llvm/asm.rs index 50e82039979ca..a6062de6bf8af 100644 --- a/src/librustc_codegen_llvm/asm.rs +++ b/src/librustc_codegen_llvm/asm.rs @@ -5,8 +5,8 @@ use crate::type_::Type; use crate::type_of::LayoutLlvmExt; use crate::value::Value; -use rustc_ast::ast::LlvmAsmDialect; -use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece}; +use rustc_ast::LlvmAsmDialect; +use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use rustc_codegen_ssa::mir::operand::OperandValue; use rustc_codegen_ssa::mir::place::PlaceRef; use rustc_codegen_ssa::traits::*; diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs index e3d90626e463b..4737c73d57ffd 100644 --- a/src/librustc_codegen_llvm/builder.rs +++ b/src/librustc_codegen_llvm/builder.rs @@ -303,8 +303,8 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { lhs: Self::Value, rhs: Self::Value, ) -> (Self::Value, Self::Value) { - use rustc_ast::ast::IntTy::*; - use rustc_ast::ast::UintTy::*; + use rustc_ast::IntTy::*; + use rustc_ast::UintTy::*; use rustc_middle::ty::{Int, Uint}; let new_kind = match ty.kind { diff --git a/src/librustc_codegen_llvm/common.rs b/src/librustc_codegen_llvm/common.rs index d822d619ffe42..0b1cf03fa7e42 100644 --- a/src/librustc_codegen_llvm/common.rs +++ b/src/librustc_codegen_llvm/common.rs @@ -9,7 +9,7 @@ use crate::type_::Type; use crate::type_of::LayoutLlvmExt; use crate::value::Value; -use rustc_ast::ast::Mutability; +use rustc_ast::Mutability; use rustc_codegen_ssa::mir::place::PlaceRef; use rustc_codegen_ssa::traits::*; use rustc_middle::bug; diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index f288135596265..9d92d53775cc7 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -18,7 +18,7 @@ use crate::llvm::debuginfo::{ }; use crate::value::Value; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_codegen_ssa::traits::*; use rustc_data_structures::const_cstr; use rustc_data_structures::fingerprint::Fingerprint; diff --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs index 323c29e82d0dd..f1977946ee9b1 100644 --- a/src/librustc_codegen_llvm/intrinsic.rs +++ b/src/librustc_codegen_llvm/intrinsic.rs @@ -7,9 +7,7 @@ use crate::type_of::LayoutLlvmExt; use crate::va_arg::emit_va_arg; use crate::value::Value; -use tracing::debug; - -use rustc_ast::ast; +use rustc_ast as ast; use rustc_codegen_ssa::base::{compare_simd_types, to_immediate, wants_msvc_seh}; use rustc_codegen_ssa::common::span_invalid_monomorphization_error; use rustc_codegen_ssa::common::{IntPredicate, TypeKind}; @@ -28,6 +26,7 @@ use rustc_middle::{bug, span_bug}; use rustc_span::{sym, symbol::kw, Span, Symbol}; use rustc_target::abi::{self, HasDataLayout, LayoutOf, Primitive}; use rustc_target::spec::PanicStrategy; +use tracing::debug; use std::cmp::Ordering; use std::iter; diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs index 63b0aa64bd3d8..32822eba930c6 100644 --- a/src/librustc_codegen_llvm/llvm/ffi.rs +++ b/src/librustc_codegen_llvm/llvm/ffi.rs @@ -389,10 +389,10 @@ pub enum AsmDialect { } impl AsmDialect { - pub fn from_generic(asm: rustc_ast::ast::LlvmAsmDialect) -> Self { + pub fn from_generic(asm: rustc_ast::LlvmAsmDialect) -> Self { match asm { - rustc_ast::ast::LlvmAsmDialect::Att => AsmDialect::Att, - rustc_ast::ast::LlvmAsmDialect::Intel => AsmDialect::Intel, + rustc_ast::LlvmAsmDialect::Att => AsmDialect::Att, + rustc_ast::LlvmAsmDialect::Intel => AsmDialect::Intel, } } } diff --git a/src/librustc_codegen_llvm/type_.rs b/src/librustc_codegen_llvm/type_.rs index 05e364884f66d..3b53b4fe77be7 100644 --- a/src/librustc_codegen_llvm/type_.rs +++ b/src/librustc_codegen_llvm/type_.rs @@ -7,7 +7,7 @@ use crate::llvm; use crate::llvm::{Bool, False, True}; use crate::type_of::LayoutLlvmExt; use crate::value::Value; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_codegen_ssa::common::TypeKind; use rustc_codegen_ssa::traits::*; use rustc_data_structures::small_c_str::SmallCStr; diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs index e8270b4fa0adb..371e1274d8d80 100644 --- a/src/librustc_codegen_ssa/mir/block.rs +++ b/src/librustc_codegen_ssa/mir/block.rs @@ -9,7 +9,7 @@ use crate::meth; use crate::traits::*; use crate::MemFlags; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_hir::lang_items; use rustc_index::vec::Idx; use rustc_middle::mir; diff --git a/src/librustc_codegen_ssa/traits/asm.rs b/src/librustc_codegen_ssa/traits/asm.rs index b6b57744f95b6..69931935c4963 100644 --- a/src/librustc_codegen_ssa/traits/asm.rs +++ b/src/librustc_codegen_ssa/traits/asm.rs @@ -1,7 +1,7 @@ use super::BackendTypes; use crate::mir::operand::OperandRef; use crate::mir::place::PlaceRef; -use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece}; +use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use rustc_hir::def_id::DefId; use rustc_hir::{GlobalAsm, LlvmInlineAsmInner}; use rustc_middle::ty::Instance; diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index cd94ccc7ad73c..09f5b22cc6381 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -15,7 +15,7 @@ extern crate lazy_static; pub extern crate rustc_plugin_impl as plugin; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_codegen_ssa::{traits::CodegenBackend, CodegenResults}; use rustc_data_structures::profiling::print_time_passes_entry; use rustc_data_structures::sync::SeqCst; diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index 2864e46cadcf9..b0fbf1e03f5af 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -1,6 +1,6 @@ //! The various pretty-printing routines. -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast_pretty::pprust; use rustc_errors::ErrorReported; use rustc_hir as hir; diff --git a/src/librustc_expand/base.rs b/src/librustc_expand/base.rs index 5a36df8299c0b..0a5e1f76d1013 100644 --- a/src/librustc_expand/base.rs +++ b/src/librustc_expand/base.rs @@ -1,12 +1,12 @@ use crate::expand::{self, AstFragment, Invocation}; use crate::module::DirectoryOwnership; -use rustc_ast::ast::{self, Attribute, NodeId, PatKind}; use rustc_ast::mut_visit::{self, MutVisitor}; use rustc_ast::ptr::P; use rustc_ast::token; use rustc_ast::tokenstream::{self, TokenStream}; use rustc_ast::visit::{AssocCtxt, Visitor}; +use rustc_ast::{self as ast, Attribute, NodeId, PatKind}; use rustc_attr::{self as attr, Deprecation, HasAttrs, Stability}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::{self, Lrc}; diff --git a/src/librustc_expand/build.rs b/src/librustc_expand/build.rs index 81ff4b3157845..7f4737a38ab5c 100644 --- a/src/librustc_expand/build.rs +++ b/src/librustc_expand/build.rs @@ -1,8 +1,8 @@ use crate::base::ExtCtxt; -use rustc_ast::ast::{self, AttrVec, BlockCheckMode, Expr, PatKind, UnOp}; use rustc_ast::attr; use rustc_ast::ptr::P; +use rustc_ast::{self as ast, AttrVec, BlockCheckMode, Expr, PatKind, UnOp}; use rustc_span::source_map::{respan, Spanned}; use rustc_span::symbol::{kw, sym, Ident, Symbol}; diff --git a/src/librustc_expand/config.rs b/src/librustc_expand/config.rs index f6ddcd35068c8..afd1e60640278 100644 --- a/src/librustc_expand/config.rs +++ b/src/librustc_expand/config.rs @@ -1,9 +1,9 @@ //! Conditional compilation stripping. -use rustc_ast::ast::{self, AttrItem, Attribute, MetaItem}; use rustc_ast::attr::HasAttrs; use rustc_ast::mut_visit::*; use rustc_ast::ptr::P; +use rustc_ast::{self as ast, AttrItem, Attribute, MetaItem}; use rustc_attr as attr; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::map_in_place::MapInPlace; diff --git a/src/librustc_expand/expand.rs b/src/librustc_expand/expand.rs index 8da56dc67e59c..7a21caf255a3c 100644 --- a/src/librustc_expand/expand.rs +++ b/src/librustc_expand/expand.rs @@ -7,13 +7,13 @@ use crate::module::{parse_external_mod, push_directory, Directory, DirectoryOwne use crate::placeholders::{placeholder, PlaceholderExpander}; use crate::proc_macro::collect_derives; -use rustc_ast::ast::{self, AttrItem, Block, LitKind, NodeId, PatKind, Path}; -use rustc_ast::ast::{ItemKind, MacArgs, MacStmtStyle, StmtKind}; use rustc_ast::mut_visit::*; use rustc_ast::ptr::P; use rustc_ast::token; use rustc_ast::tokenstream::TokenStream; use rustc_ast::visit::{self, AssocCtxt, Visitor}; +use rustc_ast::{self as ast, AttrItem, Block, LitKind, NodeId, PatKind, Path}; +use rustc_ast::{ItemKind, MacArgs, MacStmtStyle, StmtKind}; use rustc_ast_pretty::pprust; use rustc_attr::{self as attr, is_builtin_attr, HasAttrs}; use rustc_data_structures::map_in_place::MapInPlace; diff --git a/src/librustc_expand/mbe/macro_check.rs b/src/librustc_expand/mbe/macro_check.rs index ca3e68fa6706e..6b419dae3f6e2 100644 --- a/src/librustc_expand/mbe/macro_check.rs +++ b/src/librustc_expand/mbe/macro_check.rs @@ -106,8 +106,8 @@ //! bound. use crate::mbe::{KleeneToken, TokenTree}; -use rustc_ast::ast::{NodeId, DUMMY_NODE_ID}; use rustc_ast::token::{DelimToken, Token, TokenKind}; +use rustc_ast::{NodeId, DUMMY_NODE_ID}; use rustc_data_structures::fx::FxHashMap; use rustc_session::lint::builtin::META_VARIABLE_MISUSE; use rustc_session::parse::ParseSess; diff --git a/src/librustc_expand/mbe/macro_rules.rs b/src/librustc_expand/mbe/macro_rules.rs index 808d77842cb22..48a622d13efcb 100644 --- a/src/librustc_expand/mbe/macro_rules.rs +++ b/src/librustc_expand/mbe/macro_rules.rs @@ -8,7 +8,7 @@ use crate::mbe::macro_parser::{Error, ErrorReported, Failure, Success}; use crate::mbe::macro_parser::{MatchedNonterminal, MatchedSeq}; use crate::mbe::transcribe::transcribe; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::token::{self, NonterminalKind, NtTT, Token, TokenKind::*}; use rustc_ast::tokenstream::{DelimSpan, TokenStream}; use rustc_ast_pretty::pprust; diff --git a/src/librustc_expand/mbe/quoted.rs b/src/librustc_expand/mbe/quoted.rs index 774cc84afdeb1..01b11bb979d68 100644 --- a/src/librustc_expand/mbe/quoted.rs +++ b/src/librustc_expand/mbe/quoted.rs @@ -1,9 +1,9 @@ use crate::mbe::macro_parser; use crate::mbe::{Delimited, KleeneOp, KleeneToken, SequenceRepetition, TokenTree}; -use rustc_ast::ast::{NodeId, DUMMY_NODE_ID}; use rustc_ast::token::{self, Token}; use rustc_ast::tokenstream; +use rustc_ast::{NodeId, DUMMY_NODE_ID}; use rustc_ast_pretty::pprust; use rustc_session::parse::ParseSess; use rustc_span::symbol::{kw, Ident}; diff --git a/src/librustc_expand/mbe/transcribe.rs b/src/librustc_expand/mbe/transcribe.rs index e2d3d5c4d644e..b908a12c1fc9e 100644 --- a/src/librustc_expand/mbe/transcribe.rs +++ b/src/librustc_expand/mbe/transcribe.rs @@ -2,10 +2,10 @@ use crate::base::ExtCtxt; use crate::mbe; use crate::mbe::macro_parser::{MatchedNonterminal, MatchedSeq, NamedMatch}; -use rustc_ast::ast::MacCall; use rustc_ast::mut_visit::{self, MutVisitor}; use rustc_ast::token::{self, NtTT, Token}; use rustc_ast::tokenstream::{DelimSpan, TokenStream, TokenTree, TreeAndJoint}; +use rustc_ast::MacCall; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::Lrc; use rustc_errors::{pluralize, PResult}; diff --git a/src/librustc_expand/module.rs b/src/librustc_expand/module.rs index 12fe49ed585f0..1e123a2e14553 100644 --- a/src/librustc_expand/module.rs +++ b/src/librustc_expand/module.rs @@ -1,5 +1,4 @@ -use rustc_ast::ast::{Attribute, Mod}; -use rustc_ast::token; +use rustc_ast::{token, Attribute, Mod}; use rustc_errors::{struct_span_err, PResult}; use rustc_parse::new_parser_from_file; use rustc_session::parse::ParseSess; diff --git a/src/librustc_expand/mut_visit/tests.rs b/src/librustc_expand/mut_visit/tests.rs index 0608ccfffb858..38ff594b6e9c1 100644 --- a/src/librustc_expand/mut_visit/tests.rs +++ b/src/librustc_expand/mut_visit/tests.rs @@ -1,6 +1,6 @@ use crate::tests::{matches_codepattern, string_to_crate}; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::mut_visit::{self, MutVisitor}; use rustc_ast_pretty::pprust; use rustc_span::symbol::Ident; diff --git a/src/librustc_expand/parse/tests.rs b/src/librustc_expand/parse/tests.rs index 5c9116b2f139d..643305f153ccd 100644 --- a/src/librustc_expand/parse/tests.rs +++ b/src/librustc_expand/parse/tests.rs @@ -1,10 +1,10 @@ use crate::tests::{matches_codepattern, string_to_stream, with_error_checking_parse}; -use rustc_ast::ast::{self, PatKind}; use rustc_ast::ptr::P; use rustc_ast::token::{self, Token}; use rustc_ast::tokenstream::{DelimSpan, TokenStream, TokenTree}; use rustc_ast::visit; +use rustc_ast::{self as ast, PatKind}; use rustc_ast_pretty::pprust::item_to_string; use rustc_errors::PResult; use rustc_parse::new_parser_from_source_str; diff --git a/src/librustc_expand/placeholders.rs b/src/librustc_expand/placeholders.rs index b4ffd714feffa..0788823b0e776 100644 --- a/src/librustc_expand/placeholders.rs +++ b/src/librustc_expand/placeholders.rs @@ -1,7 +1,7 @@ use crate::base::ExtCtxt; use crate::expand::{AstFragment, AstFragmentKind}; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::mut_visit::*; use rustc_ast::ptr::P; use rustc_span::source_map::{dummy_spanned, DUMMY_SP}; diff --git a/src/librustc_expand/proc_macro.rs b/src/librustc_expand/proc_macro.rs index 85fbf3bc0d0b0..4e865c20d6f4a 100644 --- a/src/librustc_expand/proc_macro.rs +++ b/src/librustc_expand/proc_macro.rs @@ -1,9 +1,9 @@ use crate::base::{self, *}; use crate::proc_macro_server; -use rustc_ast::ast::{self, ItemKind, MetaItemKind, NestedMetaItem}; use rustc_ast::token; use rustc_ast::tokenstream::{TokenStream, TokenTree}; +use rustc_ast::{self as ast, *}; use rustc_data_structures::sync::Lrc; use rustc_errors::{Applicability, ErrorReported}; use rustc_parse::nt_to_tokenstream; diff --git a/src/librustc_expand/proc_macro_server.rs b/src/librustc_expand/proc_macro_server.rs index 83a650443bcba..33e35cd0404fb 100644 --- a/src/librustc_expand/proc_macro_server.rs +++ b/src/librustc_expand/proc_macro_server.rs @@ -1,6 +1,6 @@ use crate::base::ExtCtxt; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::token; use rustc_ast::tokenstream::{self, DelimSpan, IsJoint::*, TokenStream, TreeAndJoint}; use rustc_ast_pretty::pprust; diff --git a/src/librustc_expand/tests.rs b/src/librustc_expand/tests.rs index b562a690f8361..6993ce58fa6c4 100644 --- a/src/librustc_expand/tests.rs +++ b/src/librustc_expand/tests.rs @@ -1,4 +1,4 @@ -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::tokenstream::TokenStream; use rustc_parse::{new_parser_from_source_str, parser::Parser, source_file_to_stream}; use rustc_session::parse::ParseSess; diff --git a/src/librustc_hir/arena.rs b/src/librustc_hir/arena.rs index 6ba396666070a..85ab7906d2550 100644 --- a/src/librustc_hir/arena.rs +++ b/src/librustc_hir/arena.rs @@ -15,8 +15,8 @@ macro_rules! arena_types { [few] hir_krate: rustc_hir::Crate<$tcx>, [] arm: rustc_hir::Arm<$tcx>, [] asm_operand: rustc_hir::InlineAsmOperand<$tcx>, - [] asm_template: rustc_ast::ast::InlineAsmTemplatePiece, - [] attribute: rustc_ast::ast::Attribute, + [] asm_template: rustc_ast::InlineAsmTemplatePiece, + [] attribute: rustc_ast::Attribute, [] block: rustc_hir::Block<$tcx>, [] bare_fn_ty: rustc_hir::BareFnTy<$tcx>, [few] global_asm: rustc_hir::GlobalAsm, diff --git a/src/librustc_hir/def.rs b/src/librustc_hir/def.rs index c4877be3f6415..fb7fced27c280 100644 --- a/src/librustc_hir/def.rs +++ b/src/librustc_hir/def.rs @@ -1,8 +1,8 @@ use crate::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use crate::hir; -use rustc_ast::ast; -use rustc_ast::ast::NodeId; +use rustc_ast as ast; +use rustc_ast::NodeId; use rustc_macros::HashStable_Generic; use rustc_span::hygiene::MacroKind; diff --git a/src/librustc_hir/hir.rs b/src/librustc_hir/hir.rs index 928235adac30c..97d2d7f7f7269 100644 --- a/src/librustc_hir/hir.rs +++ b/src/librustc_hir/hir.rs @@ -3,13 +3,13 @@ use crate::def_id::DefId; crate use crate::hir_id::HirId; use crate::itemlikevisit; -use rustc_ast::ast::{self, CrateSugar, LlvmAsmDialect}; -use rustc_ast::ast::{AttrVec, Attribute, FloatTy, IntTy, Label, LitKind, StrStyle, UintTy}; -pub use rustc_ast::ast::{BorrowKind, ImplPolarity, IsAuto}; -pub use rustc_ast::ast::{CaptureBy, Movability, Mutability}; -use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use rustc_ast::node_id::NodeMap; use rustc_ast::util::parser::ExprPrecedence; +use rustc_ast::{self as ast, CrateSugar, LlvmAsmDialect}; +use rustc_ast::{AttrVec, Attribute, FloatTy, IntTy, Label, LitKind, StrStyle, UintTy}; +pub use rustc_ast::{BorrowKind, ImplPolarity, IsAuto}; +pub use rustc_ast::{CaptureBy, Movability, Mutability}; +use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use rustc_data_structures::sync::{par_for_each_in, Send, Sync}; use rustc_macros::HashStable_Generic; use rustc_span::def_id::LocalDefId; diff --git a/src/librustc_hir/intravisit.rs b/src/librustc_hir/intravisit.rs index 23d642731da4d..c2157543fbff9 100644 --- a/src/librustc_hir/intravisit.rs +++ b/src/librustc_hir/intravisit.rs @@ -34,8 +34,8 @@ use crate::hir::*; use crate::hir_id::CRATE_HIR_ID; use crate::itemlikevisit::{ItemLikeVisitor, ParItemLikeVisitor}; -use rustc_ast::ast::{Attribute, Label}; use rustc_ast::walk_list; +use rustc_ast::{Attribute, Label}; use rustc_span::symbol::{Ident, Symbol}; use rustc_span::Span; diff --git a/src/librustc_hir/lang_items.rs b/src/librustc_hir/lang_items.rs index b09657bd9b4a4..166498d2787b2 100644 --- a/src/librustc_hir/lang_items.rs +++ b/src/librustc_hir/lang_items.rs @@ -12,7 +12,7 @@ pub use self::LangItem::*; use crate::def_id::DefId; use crate::Target; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_macros::HashStable_Generic; diff --git a/src/librustc_hir/weak_lang_items.rs b/src/librustc_hir/weak_lang_items.rs index fd64361cb3540..76b95c696f7ca 100644 --- a/src/librustc_hir/weak_lang_items.rs +++ b/src/librustc_hir/weak_lang_items.rs @@ -3,7 +3,7 @@ use crate::def_id::DefId; use crate::{lang_items, LangItem, LanguageItems}; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_data_structures::fx::FxHashMap; use rustc_span::symbol::{sym, Symbol}; diff --git a/src/librustc_hir_pretty/lib.rs b/src/librustc_hir_pretty/lib.rs index 2298a80ae4f1f..055846c42789c 100644 --- a/src/librustc_hir_pretty/lib.rs +++ b/src/librustc_hir_pretty/lib.rs @@ -1,7 +1,7 @@ #![feature(or_patterns)] #![recursion_limit = "256"] -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::util::parser::{self, AssocOp, Fixity}; use rustc_ast_pretty::pp::Breaks::{Consistent, Inconsistent}; use rustc_ast_pretty::pp::{self, Breaks}; diff --git a/src/librustc_incremental/assert_dep_graph.rs b/src/librustc_incremental/assert_dep_graph.rs index df602d8bd1bea..e17396422f13f 100644 --- a/src/librustc_incremental/assert_dep_graph.rs +++ b/src/librustc_incremental/assert_dep_graph.rs @@ -33,7 +33,7 @@ //! fn baz() { foo(); } //! ``` -use rustc_ast::ast; +use rustc_ast as ast; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::graph::implementation::{Direction, NodeIndex, INCOMING, OUTGOING}; use rustc_graphviz as dot; diff --git a/src/librustc_incremental/assert_module_sources.rs b/src/librustc_incremental/assert_module_sources.rs index ed04a947485c7..80448c01a262d 100644 --- a/src/librustc_incremental/assert_module_sources.rs +++ b/src/librustc_incremental/assert_module_sources.rs @@ -21,7 +21,7 @@ //! allows for doing a more fine-grained check to see if pre- or post-lto data //! was re-used. -use rustc_ast::ast; +use rustc_ast as ast; use rustc_hir::def_id::LOCAL_CRATE; use rustc_middle::mir::mono::CodegenUnitNameBuilder; use rustc_middle::ty::TyCtxt; diff --git a/src/librustc_incremental/persist/dirty_clean.rs b/src/librustc_incremental/persist/dirty_clean.rs index 0f254aee8e314..f0a1088555035 100644 --- a/src/librustc_incremental/persist/dirty_clean.rs +++ b/src/librustc_incremental/persist/dirty_clean.rs @@ -13,7 +13,7 @@ //! Errors are reported if we are in the suitable configuration but //! the required condition is not met. -use rustc_ast::ast::{self, Attribute, NestedMetaItem}; +use rustc_ast::{self as ast, Attribute, NestedMetaItem}; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::FxHashSet; use rustc_hir as hir; diff --git a/src/librustc_infer/infer/combine.rs b/src/librustc_infer/infer/combine.rs index 133c4bf2db5f7..3a54a6475301e 100644 --- a/src/librustc_infer/infer/combine.rs +++ b/src/librustc_infer/infer/combine.rs @@ -34,7 +34,7 @@ use super::{InferCtxt, MiscVariable, TypeTrace}; use crate::traits::{Obligation, PredicateObligations}; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_hir::def_id::DefId; use rustc_middle::traits::ObligationCause; use rustc_middle::ty::error::TypeError; diff --git a/src/librustc_interface/interface.rs b/src/librustc_interface/interface.rs index 122d6e3543cae..4d84462c42b0b 100644 --- a/src/librustc_interface/interface.rs +++ b/src/librustc_interface/interface.rs @@ -1,8 +1,8 @@ pub use crate::passes::BoxedResolver; use crate::util; -use rustc_ast::ast::{self, MetaItemKind}; use rustc_ast::token; +use rustc_ast::{self as ast, MetaItemKind}; use rustc_codegen_ssa::traits::CodegenBackend; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::sync::Lrc; diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index daa7444fb9edb..007dbfb9fdd58 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -4,7 +4,7 @@ use crate::util; use once_cell::sync::Lazy; use rustc_ast::mut_visit::MutVisitor; -use rustc_ast::{self, ast, visit}; +use rustc_ast::{self as ast, visit}; use rustc_codegen_ssa::back::link::emit_metadata; use rustc_codegen_ssa::traits::CodegenBackend; use rustc_data_structures::sync::{par_iter, Lrc, OnceCell, ParallelIterator, WorkerLocal}; diff --git a/src/librustc_interface/queries.rs b/src/librustc_interface/queries.rs index 2f32737cca00a..8b82217a91ac6 100644 --- a/src/librustc_interface/queries.rs +++ b/src/librustc_interface/queries.rs @@ -1,7 +1,7 @@ use crate::interface::{Compiler, Result}; use crate::passes::{self, BoxedResolver, QueryContext}; -use rustc_ast::{self, ast}; +use rustc_ast as ast; use rustc_codegen_ssa::traits::CodegenBackend; use rustc_data_structures::sync::{Lrc, OnceCell, WorkerLocal}; use rustc_errors::ErrorReported; diff --git a/src/librustc_interface/util.rs b/src/librustc_interface/util.rs index 36eaad16079b8..8816ba198cf00 100644 --- a/src/librustc_interface/util.rs +++ b/src/librustc_interface/util.rs @@ -1,8 +1,7 @@ -use rustc_ast::ast::{AttrVec, BlockCheckMode}; use rustc_ast::mut_visit::{visit_clobber, MutVisitor, *}; use rustc_ast::ptr::P; use rustc_ast::util::lev_distance::find_best_match_for_name; -use rustc_ast::{self, ast}; +use rustc_ast::{self as ast, AttrVec, BlockCheckMode}; use rustc_codegen_ssa::traits::CodegenBackend; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 3859d0f163ad5..b41dbf68400ef 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -23,10 +23,10 @@ use crate::{ types::CItemKind, EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext, }; -use rustc_ast::ast::{self, Expr}; use rustc_ast::attr::{self, HasAttrs}; use rustc_ast::tokenstream::{TokenStream, TokenTree}; use rustc_ast::visit::{FnCtxt, FnKind}; +use rustc_ast::{self as ast, *}; use rustc_ast_pretty::pprust::{self, expr_to_string}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::{Applicability, DiagnosticBuilder, DiagnosticStyledString}; @@ -1287,7 +1287,7 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns { return; } - use self::ast::{PatKind, RangeEnd, RangeSyntax::DotDotDot}; + use self::ast::{PatKind, RangeSyntax::DotDotDot}; /// If `pat` is a `...` pattern, return the start and end of the range, as well as the span /// corresponding to the ellipsis. @@ -1860,7 +1860,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue { /// Test if this constant is all-0. fn is_zero(expr: &hir::Expr<'_>) -> bool { use hir::ExprKind::*; - use rustc_ast::ast::LitKind::*; + use rustc_ast::LitKind::*; match &expr.kind { Lit(lit) => { if let Int(i, _) = lit.node { diff --git a/src/librustc_lint/context.rs b/src/librustc_lint/context.rs index 31d30a264a59e..c9e5f60e16cbd 100644 --- a/src/librustc_lint/context.rs +++ b/src/librustc_lint/context.rs @@ -18,7 +18,7 @@ use self::TargetLint::*; use crate::levels::LintLevelsBuilder; use crate::passes::{EarlyLintPassObject, LateLintPassObject}; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::util::lev_distance::find_best_match_for_name; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync; diff --git a/src/librustc_lint/early.rs b/src/librustc_lint/early.rs index 017d4e31e4a71..998676d44d23c 100644 --- a/src/librustc_lint/early.rs +++ b/src/librustc_lint/early.rs @@ -16,7 +16,7 @@ use crate::context::{EarlyContext, LintContext, LintStore}; use crate::passes::{EarlyLintPass, EarlyLintPassObject}; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::visit as ast_visit; use rustc_session::lint::{BufferedEarlyLint, LintBuffer, LintPass}; use rustc_session::Session; diff --git a/src/librustc_lint/internal.rs b/src/librustc_lint/internal.rs index 30fae32439292..100e555f299ae 100644 --- a/src/librustc_lint/internal.rs +++ b/src/librustc_lint/internal.rs @@ -2,7 +2,7 @@ //! Clippy. use crate::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext}; -use rustc_ast::ast::{Item, ItemKind}; +use rustc_ast::{Item, ItemKind}; use rustc_data_structures::fx::FxHashMap; use rustc_errors::Applicability; use rustc_hir::{GenericArg, HirId, MutTy, Mutability, Path, PathSegment, QPath, Ty, TyKind}; diff --git a/src/librustc_lint/late.rs b/src/librustc_lint/late.rs index 6c497d0228519..a6c04fb0b4c84 100644 --- a/src/librustc_lint/late.rs +++ b/src/librustc_lint/late.rs @@ -15,7 +15,7 @@ //! for all lint attributes. use crate::{passes::LateLintPassObject, LateContext, LateLintPass, LintStore}; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::walk_list; use rustc_data_structures::sync::{join, par_iter, ParallelIterator}; use rustc_hir as hir; diff --git a/src/librustc_lint/levels.rs b/src/librustc_lint/levels.rs index 145a07d8dc852..48254dcee82fe 100644 --- a/src/librustc_lint/levels.rs +++ b/src/librustc_lint/levels.rs @@ -1,6 +1,6 @@ use crate::context::{CheckLintNameResult, LintStore}; use crate::late::unerased_lint_store; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::attr; use rustc_ast::unwrap_or; use rustc_ast_pretty::pprust; diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 1f17c7dcba43f..0a14b16e274c8 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -55,7 +55,7 @@ mod redundant_semicolon; mod types; mod unused; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_hir as hir; use rustc_hir::def_id::LocalDefId; use rustc_middle::ty::query::Providers; diff --git a/src/librustc_lint/non_ascii_idents.rs b/src/librustc_lint/non_ascii_idents.rs index ab1658b222982..2f0b2a8d68028 100644 --- a/src/librustc_lint/non_ascii_idents.rs +++ b/src/librustc_lint/non_ascii_idents.rs @@ -1,5 +1,5 @@ use crate::{EarlyContext, EarlyLintPass, LintContext}; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_data_structures::fx::FxHashMap; use rustc_span::symbol::Symbol; diff --git a/src/librustc_lint/nonstandard_style.rs b/src/librustc_lint/nonstandard_style.rs index 5ca6f461048c3..f23e8c5e20888 100644 --- a/src/librustc_lint/nonstandard_style.rs +++ b/src/librustc_lint/nonstandard_style.rs @@ -1,5 +1,5 @@ use crate::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext}; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_attr as attr; use rustc_errors::Applicability; use rustc_hir as hir; diff --git a/src/librustc_lint/passes.rs b/src/librustc_lint/passes.rs index 75e50f74a819a..159286c13a4ce 100644 --- a/src/librustc_lint/passes.rs +++ b/src/librustc_lint/passes.rs @@ -1,6 +1,6 @@ use crate::context::{EarlyContext, LateContext}; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_data_structures::sync; use rustc_hir as hir; use rustc_session::lint::builtin::HardwiredLints; diff --git a/src/librustc_lint/redundant_semicolon.rs b/src/librustc_lint/redundant_semicolon.rs index 0f807cd497e56..d4aa4968f25ee 100644 --- a/src/librustc_lint/redundant_semicolon.rs +++ b/src/librustc_lint/redundant_semicolon.rs @@ -1,5 +1,5 @@ use crate::{EarlyContext, EarlyLintPass, LintContext}; -use rustc_ast::ast::{Block, StmtKind}; +use rustc_ast::{Block, StmtKind}; use rustc_errors::Applicability; use rustc_span::Span; diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 5891abcfd9cd1..baf4a24db80df 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -1,7 +1,7 @@ #![allow(non_snake_case)] use crate::{LateContext, LateLintPass, LintContext}; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_attr as attr; use rustc_data_structures::fx::FxHashSet; use rustc_errors::Applicability; @@ -195,8 +195,8 @@ fn report_bin_hex_error( // // No suggestion for: `isize`, `usize`. fn get_type_suggestion(t: Ty<'_>, val: u128, negative: bool) -> Option<&'static str> { - use rustc_ast::ast::IntTy::*; - use rustc_ast::ast::UintTy::*; + use rustc_ast::IntTy::*; + use rustc_ast::UintTy::*; macro_rules! find_fit { ($ty:expr, $val:expr, $negative:expr, $($type:ident => [$($utypes:expr),*] => [$($itypes:expr),*]),+) => { diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs index 95e51b47be34b..c793e81ebe38b 100644 --- a/src/librustc_lint/unused.rs +++ b/src/librustc_lint/unused.rs @@ -1,8 +1,8 @@ use crate::Lint; use crate::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext}; -use rustc_ast::ast; -use rustc_ast::ast::{ExprKind, StmtKind}; +use rustc_ast as ast; use rustc_ast::util::parser; +use rustc_ast::{ExprKind, StmtKind}; use rustc_ast_pretty::pprust; use rustc_data_structures::fx::FxHashMap; use rustc_errors::{pluralize, Applicability}; @@ -526,7 +526,7 @@ trait UnusedDelimLint { } fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) { - use rustc_ast::ast::ExprKind::*; + use rustc_ast::ExprKind::*; let (value, ctx, followed_by_block, left_pos, right_pos) = match e.kind { // Do not lint `unused_braces` in `if let` expressions. If(ref cond, ref block, ..) diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs index 9827b22233137..f8446d83d2b9e 100644 --- a/src/librustc_metadata/creader.rs +++ b/src/librustc_metadata/creader.rs @@ -5,7 +5,7 @@ use crate::locator::{CrateError, CrateLocator, CratePaths}; use crate::rmeta::{CrateDep, CrateMetadata, CrateNumMap, CrateRoot, MetadataBlob}; use rustc_ast::expand::allocator::AllocatorKind; -use rustc_ast::{ast, visit}; +use rustc_ast::{self as ast, *}; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::Lrc; diff --git a/src/librustc_metadata/rmeta/decoder.rs b/src/librustc_metadata/rmeta/decoder.rs index 1e4556f5fc8ef..10f5b671748da 100644 --- a/src/librustc_metadata/rmeta/decoder.rs +++ b/src/librustc_metadata/rmeta/decoder.rs @@ -4,7 +4,7 @@ use crate::creader::CrateMetadataRef; use crate::rmeta::table::{FixedSizeEncoding, Table}; use crate::rmeta::*; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_attr as attr; use rustc_data_structures::captures::Captures; use rustc_data_structures::fingerprint::{Fingerprint, FingerprintDecoder}; diff --git a/src/librustc_metadata/rmeta/decoder/cstore_impl.rs b/src/librustc_metadata/rmeta/decoder/cstore_impl.rs index 10b89cdd15a52..74d29b3df018a 100644 --- a/src/librustc_metadata/rmeta/decoder/cstore_impl.rs +++ b/src/librustc_metadata/rmeta/decoder/cstore_impl.rs @@ -4,7 +4,7 @@ use crate::link_args; use crate::native_libs; use crate::rmeta::{self, encoder}; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::expand::allocator::AllocatorKind; use rustc_data_structures::svh::Svh; use rustc_hir as hir; diff --git a/src/librustc_metadata/rmeta/encoder.rs b/src/librustc_metadata/rmeta/encoder.rs index 0343fbeb0fad8..cb3bf10926b7d 100644 --- a/src/librustc_metadata/rmeta/encoder.rs +++ b/src/librustc_metadata/rmeta/encoder.rs @@ -1,7 +1,7 @@ use crate::rmeta::table::{FixedSizeEncoding, TableBuilder}; use crate::rmeta::*; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_data_structures::fingerprint::{Fingerprint, FingerprintEncoder}; use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet}; use rustc_data_structures::stable_hasher::StableHasher; diff --git a/src/librustc_metadata/rmeta/mod.rs b/src/librustc_metadata/rmeta/mod.rs index b15c20e515f49..ac1ac3607017b 100644 --- a/src/librustc_metadata/rmeta/mod.rs +++ b/src/librustc_metadata/rmeta/mod.rs @@ -1,7 +1,7 @@ use decoder::Metadata; use table::{Table, TableBuilder}; -use rustc_ast::ast::{self, MacroDef}; +use rustc_ast::{self as ast, MacroDef}; use rustc_attr as attr; use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::MetadataRef; diff --git a/src/librustc_middle/arena.rs b/src/librustc_middle/arena.rs index 99889c74da0ec..f6570cc95d27d 100644 --- a/src/librustc_middle/arena.rs +++ b/src/librustc_middle/arena.rs @@ -81,7 +81,7 @@ macro_rules! arena_types { [] upvars_mentioned: rustc_data_structures::fx::FxIndexMap, [] object_safety_violations: rustc_middle::traits::ObjectSafetyViolation, [] codegen_unit: rustc_middle::mir::mono::CodegenUnit<$tcx>, - [] attribute: rustc_ast::ast::Attribute, + [] attribute: rustc_ast::Attribute, [] name_set: rustc_data_structures::fx::FxHashSet, [] hir_id_set: rustc_hir::HirIdSet, @@ -98,7 +98,7 @@ macro_rules! arena_types { // Note that this deliberately duplicates items in the `rustc_hir::arena`, // since we need to allocate this type on both the `rustc_hir` arena // (during lowering) and the `librustc_middle` arena (for decoding MIR) - [decode] asm_template: rustc_ast::ast::InlineAsmTemplatePiece, + [decode] asm_template: rustc_ast::InlineAsmTemplatePiece, // This is used to decode the &'tcx [Span] for InlineAsm's line_spans. [decode] span: rustc_span::Span, diff --git a/src/librustc_middle/hir/map/blocks.rs b/src/librustc_middle/hir/map/blocks.rs index a2e4372f017ce..6f572a4875f86 100644 --- a/src/librustc_middle/hir/map/blocks.rs +++ b/src/librustc_middle/hir/map/blocks.rs @@ -12,7 +12,7 @@ //! for the `Code` associated with a particular NodeId. use crate::hir::map::Map; -use rustc_ast::ast::Attribute; +use rustc_ast::Attribute; use rustc_hir as hir; use rustc_hir::intravisit::FnKind; use rustc_hir::{Expr, FnDecl, Node}; diff --git a/src/librustc_middle/hir/map/mod.rs b/src/librustc_middle/hir/map/mod.rs index 0794caca1baa5..a6cc7cbc9207c 100644 --- a/src/librustc_middle/hir/map/mod.rs +++ b/src/librustc_middle/hir/map/mod.rs @@ -3,7 +3,7 @@ use self::collector::NodeCollector; use crate::hir::{Owner, OwnerNodes}; use crate::ty::query::Providers; use crate::ty::TyCtxt; -use rustc_ast::ast::{self}; +use rustc_ast as ast; use rustc_data_structures::svh::Svh; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE}; diff --git a/src/librustc_middle/ich/hcx.rs b/src/librustc_middle/ich/hcx.rs index 19a7d2ec2218d..084fe4cfa168a 100644 --- a/src/librustc_middle/ich/hcx.rs +++ b/src/librustc_middle/ich/hcx.rs @@ -2,7 +2,7 @@ use crate::ich; use crate::middle::cstore::CrateStore; use crate::ty::{fast_reject, TyCtxt}; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::Lrc; diff --git a/src/librustc_middle/ich/impls_syntax.rs b/src/librustc_middle/ich/impls_syntax.rs index 300aac19e51b0..e3d4655831b32 100644 --- a/src/librustc_middle/ich/impls_syntax.rs +++ b/src/librustc_middle/ich/impls_syntax.rs @@ -3,7 +3,7 @@ use crate::ich::StableHashingContext; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_span::SourceFile; diff --git a/src/librustc_middle/middle/cstore.rs b/src/librustc_middle/middle/cstore.rs index 6a8f6c3e20203..6759ad61d3a39 100644 --- a/src/librustc_middle/middle/cstore.rs +++ b/src/librustc_middle/middle/cstore.rs @@ -4,7 +4,7 @@ use crate::ty::TyCtxt; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::expand::allocator::AllocatorKind; use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::{self, MetadataRef}; diff --git a/src/librustc_middle/middle/limits.rs b/src/librustc_middle/middle/limits.rs index e982053948479..def9e5ebb527f 100644 --- a/src/librustc_middle/middle/limits.rs +++ b/src/librustc_middle/middle/limits.rs @@ -6,7 +6,7 @@ //! just peeks and looks for that attribute. use crate::bug; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_data_structures::sync::OnceCell; use rustc_session::{Limit, Session}; use rustc_span::symbol::{sym, Symbol}; diff --git a/src/librustc_middle/middle/stability.rs b/src/librustc_middle/middle/stability.rs index b913d7dd4ad0b..b32eebbb11e2c 100644 --- a/src/librustc_middle/middle/stability.rs +++ b/src/librustc_middle/middle/stability.rs @@ -4,7 +4,7 @@ pub use self::StabilityLevel::*; use crate::ty::{self, TyCtxt}; -use rustc_ast::ast::CRATE_NODE_ID; +use rustc_ast::CRATE_NODE_ID; use rustc_attr::{self as attr, ConstStability, Deprecation, Stability}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::{Applicability, DiagnosticBuilder}; diff --git a/src/librustc_middle/mir/interpret/allocation.rs b/src/librustc_middle/mir/interpret/allocation.rs index bee8d13c762f9..505939d56ed32 100644 --- a/src/librustc_middle/mir/interpret/allocation.rs +++ b/src/librustc_middle/mir/interpret/allocation.rs @@ -5,7 +5,7 @@ use std::convert::TryFrom; use std::iter; use std::ops::{Deref, DerefMut, Range}; -use rustc_ast::ast::Mutability; +use rustc_ast::Mutability; use rustc_data_structures::sorted_map::SortedMap; use rustc_target::abi::{Align, HasDataLayout, Size}; diff --git a/src/librustc_middle/mir/interpret/mod.rs b/src/librustc_middle/mir/interpret/mod.rs index e607da29ce453..fb7269f648f03 100644 --- a/src/librustc_middle/mir/interpret/mod.rs +++ b/src/librustc_middle/mir/interpret/mod.rs @@ -102,7 +102,7 @@ use std::num::NonZeroU32; use std::sync::atomic::{AtomicU32, Ordering}; use byteorder::{BigEndian, LittleEndian, ReadBytesExt, WriteBytesExt}; -use rustc_ast::ast::LitKind; +use rustc_ast::LitKind; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::{HashMapExt, Lock}; use rustc_data_structures::tiny_list::TinyList; diff --git a/src/librustc_middle/mir/mod.rs b/src/librustc_middle/mir/mod.rs index 6a2b1d115848b..1faed87f8ff17 100644 --- a/src/librustc_middle/mir/mod.rs +++ b/src/librustc_middle/mir/mod.rs @@ -19,7 +19,7 @@ use rustc_hir::{self, GeneratorKind}; use rustc_target::abi::VariantIdx; use polonius_engine::Atom; -pub use rustc_ast::ast::Mutability; +pub use rustc_ast::Mutability; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::graph::dominators::{dominators, Dominators}; use rustc_data_structures::graph::{self, GraphSuccessors}; diff --git a/src/librustc_middle/mir/terminator/mod.rs b/src/librustc_middle/mir/terminator/mod.rs index 0ab783812241e..e8fe3a97a10c7 100644 --- a/src/librustc_middle/mir/terminator/mod.rs +++ b/src/librustc_middle/mir/terminator/mod.rs @@ -1,12 +1,12 @@ use crate::mir::interpret::Scalar; use crate::ty::{self, Ty, TyCtxt}; -use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece}; +use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use super::{ AssertMessage, BasicBlock, InlineAsmOperand, Operand, Place, SourceInfo, Successors, SuccessorsMut, }; -pub use rustc_ast::ast::Mutability; +pub use rustc_ast::Mutability; use rustc_macros::HashStable; use rustc_span::Span; use std::borrow::Cow; diff --git a/src/librustc_middle/ty/cast.rs b/src/librustc_middle/ty/cast.rs index 3a3caa55f6077..79a3008c364e9 100644 --- a/src/librustc_middle/ty/cast.rs +++ b/src/librustc_middle/ty/cast.rs @@ -3,7 +3,7 @@ use crate::ty::{self, Ty}; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_macros::HashStable; /// Types that are represented as ints. diff --git a/src/librustc_middle/ty/context.rs b/src/librustc_middle/ty/context.rs index d7eeaafbf46bf..c36aabd908bdc 100644 --- a/src/librustc_middle/ty/context.rs +++ b/src/librustc_middle/ty/context.rs @@ -24,7 +24,7 @@ use crate::ty::{ ProjectionTy, Region, RegionKind, ReprOptions, TraitObjectVisitor, Ty, TyKind, TyS, TyVar, TyVid, TypeAndMut, }; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::expand::allocator::AllocatorKind; use rustc_attr as attr; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; diff --git a/src/librustc_middle/ty/error.rs b/src/librustc_middle/ty/error.rs index 438da832226d7..1963881626ea9 100644 --- a/src/librustc_middle/ty/error.rs +++ b/src/librustc_middle/ty/error.rs @@ -1,7 +1,7 @@ use crate::traits::{ObligationCause, ObligationCauseCode}; use crate::ty::diagnostics::suggest_constraining_type_param; use crate::ty::{self, BoundRegion, Region, Ty, TyCtxt}; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_errors::Applicability::{MachineApplicable, MaybeIncorrect}; use rustc_errors::{pluralize, DiagnosticBuilder}; use rustc_hir as hir; diff --git a/src/librustc_middle/ty/fast_reject.rs b/src/librustc_middle/ty/fast_reject.rs index 7456020ee9b67..1bee2d60f7513 100644 --- a/src/librustc_middle/ty/fast_reject.rs +++ b/src/librustc_middle/ty/fast_reject.rs @@ -1,6 +1,6 @@ use crate::ich::StableHashingContext; use crate::ty::{self, Ty, TyCtxt}; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_hir::def_id::DefId; use std::fmt::Debug; diff --git a/src/librustc_middle/ty/layout.rs b/src/librustc_middle/ty/layout.rs index 16e65d2cca4cb..928cba324d584 100644 --- a/src/librustc_middle/ty/layout.rs +++ b/src/librustc_middle/ty/layout.rs @@ -4,7 +4,7 @@ use crate::mir::{GeneratorLayout, GeneratorSavedLocal}; use crate::ty::subst::Subst; use crate::ty::{self, subst::SubstsRef, ReprOptions, Ty, TyCtxt, TypeFoldable}; -use rustc_ast::ast::{self, IntTy, UintTy}; +use rustc_ast::{self as ast, IntTy, UintTy}; use rustc_attr as attr; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_hir as hir; diff --git a/src/librustc_middle/ty/mod.rs b/src/librustc_middle/ty/mod.rs index 3c79fe1225579..02fd18ef968c5 100644 --- a/src/librustc_middle/ty/mod.rs +++ b/src/librustc_middle/ty/mod.rs @@ -17,7 +17,7 @@ use crate::traits::{self, Reveal}; use crate::ty; use crate::ty::subst::{GenericArg, InternalSubsts, Subst, SubstsRef}; use crate::ty::util::{Discr, IntTypeExt}; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_attr as attr; use rustc_data_structures::captures::Captures; use rustc_data_structures::fingerprint::Fingerprint; diff --git a/src/librustc_middle/ty/print/pretty.rs b/src/librustc_middle/ty/print/pretty.rs index fc444d4cc5b52..999a1d52a26a2 100644 --- a/src/librustc_middle/ty/print/pretty.rs +++ b/src/librustc_middle/ty/print/pretty.rs @@ -5,7 +5,7 @@ use crate::ty::subst::{GenericArg, GenericArgKind, Subst}; use crate::ty::{self, ConstInt, DefIdTree, ParamConst, Ty, TyCtxt, TypeFoldable}; use rustc_apfloat::ieee::{Double, Single}; use rustc_apfloat::Float; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_attr::{SignedInt, UnsignedInt}; use rustc_hir as hir; use rustc_hir::def::{CtorKind, DefKind, Namespace}; diff --git a/src/librustc_middle/ty/query/mod.rs b/src/librustc_middle/ty/query/mod.rs index 4d820f75c56c4..f220c4fb0728f 100644 --- a/src/librustc_middle/ty/query/mod.rs +++ b/src/librustc_middle/ty/query/mod.rs @@ -50,7 +50,7 @@ use rustc_session::utils::NativeLibKind; use rustc_session::CrateDisambiguator; use rustc_target::spec::PanicStrategy; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_attr as attr; use rustc_span::symbol::Symbol; use rustc_span::{Span, DUMMY_SP}; diff --git a/src/librustc_middle/ty/query/on_disk_cache.rs b/src/librustc_middle/ty/query/on_disk_cache.rs index 007b46b117694..dcfb8d314300f 100644 --- a/src/librustc_middle/ty/query/on_disk_cache.rs +++ b/src/librustc_middle/ty/query/on_disk_cache.rs @@ -766,9 +766,7 @@ impl<'a, 'tcx> Decodable> for &'tcx [(ty::Predicate<'tcx> } } -impl<'a, 'tcx> Decodable> - for &'tcx [rustc_ast::ast::InlineAsmTemplatePiece] -{ +impl<'a, 'tcx> Decodable> for &'tcx [rustc_ast::InlineAsmTemplatePiece] { fn decode(d: &mut CacheDecoder<'a, 'tcx>) -> Result { RefDecodable::decode(d) } diff --git a/src/librustc_middle/ty/structural_impls.rs b/src/librustc_middle/ty/structural_impls.rs index dfa9e38a466eb..ffa5df6ef2d40 100644 --- a/src/librustc_middle/ty/structural_impls.rs +++ b/src/librustc_middle/ty/structural_impls.rs @@ -274,10 +274,10 @@ CloneTypeFoldableAndLiftImpls! { u64, String, crate::middle::region::Scope, - ::rustc_ast::ast::FloatTy, - ::rustc_ast::ast::InlineAsmOptions, - ::rustc_ast::ast::InlineAsmTemplatePiece, - ::rustc_ast::ast::NodeId, + ::rustc_ast::FloatTy, + ::rustc_ast::InlineAsmOptions, + ::rustc_ast::InlineAsmTemplatePiece, + ::rustc_ast::NodeId, ::rustc_span::symbol::Symbol, ::rustc_hir::def::Res, ::rustc_hir::def_id::DefId, diff --git a/src/librustc_middle/ty/sty.rs b/src/librustc_middle/ty/sty.rs index 82160681ee8cf..176bad6277f27 100644 --- a/src/librustc_middle/ty/sty.rs +++ b/src/librustc_middle/ty/sty.rs @@ -12,7 +12,7 @@ use crate::ty::{ }; use crate::ty::{DelaySpanBugEmitted, List, ParamEnv, TyS}; use polonius_engine::Atom; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_data_structures::captures::Captures; use rustc_hir as hir; use rustc_hir::def_id::DefId; diff --git a/src/librustc_middle/ty/util.rs b/src/librustc_middle/ty/util.rs index 5c5fe9dbd7abf..63d4dcca0804a 100644 --- a/src/librustc_middle/ty/util.rs +++ b/src/librustc_middle/ty/util.rs @@ -10,7 +10,7 @@ use crate::ty::subst::{GenericArgKind, InternalSubsts, Subst, SubstsRef}; use crate::ty::TyKind::*; use crate::ty::{self, DefIdTree, GenericParamDefKind, List, Ty, TyCtxt, TypeFoldable}; use rustc_apfloat::Float as _; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_attr::{self as attr, SignedInt, UnsignedInt}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; diff --git a/src/librustc_mir/const_eval/machine.rs b/src/librustc_mir/const_eval/machine.rs index 2d0e68d58943f..b0357c508a3e0 100644 --- a/src/librustc_mir/const_eval/machine.rs +++ b/src/librustc_mir/const_eval/machine.rs @@ -7,7 +7,7 @@ use std::hash::Hash; use rustc_data_structures::fx::FxHashMap; -use rustc_ast::ast::Mutability; +use rustc_ast::Mutability; use rustc_hir::def_id::DefId; use rustc_middle::mir::AssertMessage; use rustc_session::Limit; diff --git a/src/librustc_mir/dataflow/framework/engine.rs b/src/librustc_mir/dataflow/framework/engine.rs index 89e2d7088f7b6..b703852b1def7 100644 --- a/src/librustc_mir/dataflow/framework/engine.rs +++ b/src/librustc_mir/dataflow/framework/engine.rs @@ -4,7 +4,7 @@ use std::ffi::OsString; use std::fs; use std::path::PathBuf; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_data_structures::work_queue::WorkQueue; use rustc_graphviz as dot; use rustc_hir::def_id::DefId; diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs index fdec5729a5425..a0c246360599c 100644 --- a/src/librustc_mir/dataflow/mod.rs +++ b/src/librustc_mir/dataflow/mod.rs @@ -1,4 +1,4 @@ -use rustc_ast::ast::{self, MetaItem}; +use rustc_ast::{self as ast, MetaItem}; use rustc_middle::ty; use rustc_session::Session; use rustc_span::symbol::{sym, Symbol}; diff --git a/src/librustc_mir/interpret/cast.rs b/src/librustc_mir/interpret/cast.rs index 78f149f6451e6..501a5bcddb3f2 100644 --- a/src/librustc_mir/interpret/cast.rs +++ b/src/librustc_mir/interpret/cast.rs @@ -2,7 +2,7 @@ use std::convert::TryFrom; use rustc_apfloat::ieee::{Double, Single}; use rustc_apfloat::{Float, FloatConvert}; -use rustc_ast::ast::FloatTy; +use rustc_ast::FloatTy; use rustc_attr as attr; use rustc_middle::mir::interpret::{InterpResult, PointerArithmetic, Scalar}; use rustc_middle::mir::CastKind; diff --git a/src/librustc_mir/interpret/intern.rs b/src/librustc_mir/interpret/intern.rs index 6c8ee72bc66c2..9959c38e5c738 100644 --- a/src/librustc_mir/interpret/intern.rs +++ b/src/librustc_mir/interpret/intern.rs @@ -9,7 +9,7 @@ use rustc_hir as hir; use rustc_middle::mir::interpret::InterpResult; use rustc_middle::ty::{self, query::TyCtxtAt, Ty}; -use rustc_ast::ast::Mutability; +use rustc_ast::Mutability; use super::{AllocId, Allocation, InterpCx, MPlaceTy, Machine, MemoryKind, Scalar, ValueVisitor}; diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs index 8d80fa82185ed..d4be2ce0568fd 100644 --- a/src/librustc_mir/interpret/memory.rs +++ b/src/librustc_mir/interpret/memory.rs @@ -12,7 +12,7 @@ use std::convert::{TryFrom, TryInto}; use std::fmt; use std::ptr; -use rustc_ast::ast::Mutability; +use rustc_ast::Mutability; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_middle::ty::{Instance, ParamEnv, TyCtxt}; use rustc_target::abi::{Align, HasDataLayout, Size, TargetDataLayout}; diff --git a/src/librustc_mir/interpret/operator.rs b/src/librustc_mir/interpret/operator.rs index 607122935347e..30c40b8fde90f 100644 --- a/src/librustc_mir/interpret/operator.rs +++ b/src/librustc_mir/interpret/operator.rs @@ -1,7 +1,7 @@ use std::convert::TryFrom; use rustc_apfloat::Float; -use rustc_ast::ast::FloatTy; +use rustc_ast::FloatTy; use rustc_middle::mir; use rustc_middle::mir::interpret::{InterpResult, Scalar}; use rustc_middle::ty::{self, layout::TyAndLayout, Ty}; diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 7e8a94f181f63..be23fe7247e20 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -3,7 +3,7 @@ use std::cell::Cell; -use rustc_ast::ast::Mutability; +use rustc_ast::Mutability; use rustc_data_structures::fx::FxHashSet; use rustc_hir::def::DefKind; use rustc_hir::HirId; diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index 94637bae44a78..b2dda1caa5482 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -12,7 +12,7 @@ //! initialization and can otherwise silence errors, if //! move analysis runs after promotion on broken MIR. -use rustc_ast::ast::LitKind; +use rustc_ast::LitKind; use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_middle::mir::traversal::ReversePostorder; diff --git a/src/librustc_mir/transform/rustc_peek.rs b/src/librustc_mir/transform/rustc_peek.rs index 729e22a94dcbb..00d269a4af82f 100644 --- a/src/librustc_mir/transform/rustc_peek.rs +++ b/src/librustc_mir/transform/rustc_peek.rs @@ -1,4 +1,4 @@ -use rustc_ast::ast; +use rustc_ast as ast; use rustc_span::symbol::sym; use rustc_span::Span; use rustc_target::spec::abi::Abi; diff --git a/src/librustc_mir_build/build/expr/into.rs b/src/librustc_mir_build/build/expr/into.rs index c3f54b39a3f38..3d623abfa6eef 100644 --- a/src/librustc_mir_build/build/expr/into.rs +++ b/src/librustc_mir_build/build/expr/into.rs @@ -3,7 +3,7 @@ use crate::build::expr::category::{Category, RvalueFunc}; use crate::build::{BlockAnd, BlockAndExtension, BlockFrame, Builder}; use crate::thir::*; -use rustc_ast::ast::InlineAsmOptions; +use rustc_ast::InlineAsmOptions; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_hir as hir; diff --git a/src/librustc_mir_build/thir/constant.rs b/src/librustc_mir_build/thir/constant.rs index e5af0b5bd6bed..dd5515d39b074 100644 --- a/src/librustc_mir_build/thir/constant.rs +++ b/src/librustc_mir_build/thir/constant.rs @@ -1,4 +1,4 @@ -use rustc_ast::ast; +use rustc_ast as ast; use rustc_middle::mir::interpret::{ truncate, Allocation, ConstValue, LitToConstError, LitToConstInput, Scalar, }; diff --git a/src/librustc_mir_build/thir/cx/mod.rs b/src/librustc_mir_build/thir/cx/mod.rs index bb814ab824883..cf42fee873e15 100644 --- a/src/librustc_mir_build/thir/cx/mod.rs +++ b/src/librustc_mir_build/thir/cx/mod.rs @@ -5,7 +5,7 @@ use crate::thir::util::UserAnnotatedTyHelpers; use crate::thir::*; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_hir as hir; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_hir::Node; diff --git a/src/librustc_mir_build/thir/mod.rs b/src/librustc_mir_build/thir/mod.rs index b6ce7e0b41e54..2837bfa040ff7 100644 --- a/src/librustc_mir_build/thir/mod.rs +++ b/src/librustc_mir_build/thir/mod.rs @@ -5,7 +5,7 @@ //! structures. use self::cx::Cx; -use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece}; +use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_middle::infer::canonical::Canonical; diff --git a/src/librustc_mir_build/thir/pattern/check_match.rs b/src/librustc_mir_build/thir/pattern/check_match.rs index 1687286093d9c..4e7108667e15f 100644 --- a/src/librustc_mir_build/thir/pattern/check_match.rs +++ b/src/librustc_mir_build/thir/pattern/check_match.rs @@ -4,7 +4,7 @@ use super::_match::{expand_pattern, is_useful, MatchCheckCtxt, Matrix, PatStack} use super::{PatCtxt, PatKind, PatternError}; use rustc_arena::TypedArena; -use rustc_ast::ast::Mutability; +use rustc_ast::Mutability; use rustc_errors::{error_code, struct_span_err, Applicability, DiagnosticBuilder}; use rustc_hir as hir; use rustc_hir::def::*; diff --git a/src/librustc_mir_build/thir/pattern/mod.rs b/src/librustc_mir_build/thir/pattern/mod.rs index daff10eb194f8..c163cb0e60c42 100644 --- a/src/librustc_mir_build/thir/pattern/mod.rs +++ b/src/librustc_mir_build/thir/pattern/mod.rs @@ -8,7 +8,7 @@ pub(crate) use self::check_match::check_match; use crate::thir::util::UserAnnotatedTyHelpers; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_errors::struct_span_err; use rustc_hir as hir; use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res}; diff --git a/src/librustc_parse/lib.rs b/src/librustc_parse/lib.rs index 829e1a97b100d..49deb3474d97a 100644 --- a/src/librustc_parse/lib.rs +++ b/src/librustc_parse/lib.rs @@ -6,7 +6,7 @@ #![feature(try_blocks)] #![feature(or_patterns)] -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::token::{self, DelimToken, Nonterminal, Token}; use rustc_ast::tokenstream::{self, TokenStream, TokenTree}; use rustc_ast_pretty::pprust; diff --git a/src/librustc_parse/parser/attr.rs b/src/librustc_parse/parser/attr.rs index c942394fa7ccb..4e4429e461f0f 100644 --- a/src/librustc_parse/parser/attr.rs +++ b/src/librustc_parse/parser/attr.rs @@ -1,5 +1,5 @@ use super::{Parser, PathStyle}; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::attr; use rustc_ast::token::{self, Nonterminal}; use rustc_ast_pretty::pprust; diff --git a/src/librustc_parse/parser/diagnostics.rs b/src/librustc_parse/parser/diagnostics.rs index 27e1bb01d5284..be01c7f849817 100644 --- a/src/librustc_parse/parser/diagnostics.rs +++ b/src/librustc_parse/parser/diagnostics.rs @@ -1,13 +1,13 @@ use super::ty::AllowPlus; use super::{BlockMode, Parser, PathStyle, SemiColonMode, SeqSep, TokenExpectType, TokenType}; -use rustc_ast::ast::{ - self, AngleBracketedArgs, AttrVec, BinOpKind, BindingMode, BlockCheckMode, Expr, ExprKind, - Item, ItemKind, Mutability, Param, Pat, PatKind, PathSegment, QSelf, Ty, TyKind, -}; use rustc_ast::ptr::P; use rustc_ast::token::{self, Lit, LitKind, TokenKind}; use rustc_ast::util::parser::AssocOp; +use rustc_ast::{ + self as ast, AngleBracketedArgs, AttrVec, BinOpKind, BindingMode, BlockCheckMode, Expr, + ExprKind, Item, ItemKind, Mutability, Param, Pat, PatKind, PathSegment, QSelf, Ty, TyKind, +}; use rustc_ast_pretty::pprust; use rustc_data_structures::fx::FxHashSet; use rustc_errors::{pluralize, struct_span_err}; diff --git a/src/librustc_parse/parser/expr.rs b/src/librustc_parse/parser/expr.rs index 0ceb588b3afe7..e5c28f225c611 100644 --- a/src/librustc_parse/parser/expr.rs +++ b/src/librustc_parse/parser/expr.rs @@ -4,14 +4,14 @@ use super::{BlockMode, Parser, PathStyle, Restrictions, TokenType}; use super::{SemiColonMode, SeqSep, TokenExpectType}; use crate::maybe_recover_from_interpolated_ty_qpath; -use rustc_ast::ast::{self, AttrStyle, AttrVec, CaptureBy, Field, Lit, UnOp, DUMMY_NODE_ID}; -use rustc_ast::ast::{AnonConst, BinOp, BinOpKind, FnDecl, FnRetTy, MacCall, Param, Ty, TyKind}; -use rustc_ast::ast::{Arm, Async, BlockCheckMode, Expr, ExprKind, Label, Movability, RangeLimits}; use rustc_ast::ptr::P; use rustc_ast::token::{self, Token, TokenKind}; use rustc_ast::util::classify; use rustc_ast::util::literal::LitError; use rustc_ast::util::parser::{prec_let_scrutinee_needs_par, AssocOp, Fixity}; +use rustc_ast::{self as ast, AttrStyle, AttrVec, CaptureBy, Field, Lit, UnOp, DUMMY_NODE_ID}; +use rustc_ast::{AnonConst, BinOp, BinOpKind, FnDecl, FnRetTy, MacCall, Param, Ty, TyKind}; +use rustc_ast::{Arm, Async, BlockCheckMode, Expr, ExprKind, Label, Movability, RangeLimits}; use rustc_ast_pretty::pprust; use rustc_errors::{Applicability, DiagnosticBuilder, PResult}; use rustc_span::source_map::{self, Span, Spanned}; diff --git a/src/librustc_parse/parser/generics.rs b/src/librustc_parse/parser/generics.rs index be72ed6dffb7c..dd99a7587dd54 100644 --- a/src/librustc_parse/parser/generics.rs +++ b/src/librustc_parse/parser/generics.rs @@ -1,7 +1,9 @@ use super::Parser; -use rustc_ast::ast::{self, Attribute, GenericBounds, GenericParam, GenericParamKind, WhereClause}; use rustc_ast::token; +use rustc_ast::{ + self as ast, Attribute, GenericBounds, GenericParam, GenericParamKind, WhereClause, +}; use rustc_errors::PResult; use rustc_span::symbol::{kw, sym}; diff --git a/src/librustc_parse/parser/item.rs b/src/librustc_parse/parser/item.rs index ce2dd15ab2601..64479bc36e015 100644 --- a/src/librustc_parse/parser/item.rs +++ b/src/librustc_parse/parser/item.rs @@ -4,16 +4,16 @@ use super::{FollowedByType, Parser, PathStyle}; use crate::maybe_whole; -use rustc_ast::ast::{self, AttrStyle, AttrVec, Attribute, DUMMY_NODE_ID}; -use rustc_ast::ast::{AssocItem, AssocItemKind, ForeignItemKind, Item, ItemKind, Mod}; -use rustc_ast::ast::{Async, Const, Defaultness, IsAuto, Mutability, Unsafe, UseTree, UseTreeKind}; -use rustc_ast::ast::{BindingMode, Block, FnDecl, FnSig, Param, SelfKind}; -use rustc_ast::ast::{EnumDef, Generics, StructField, TraitRef, Ty, TyKind, Variant, VariantData}; -use rustc_ast::ast::{FnHeader, ForeignItem, Path, PathSegment, Visibility, VisibilityKind}; -use rustc_ast::ast::{MacArgs, MacCall, MacDelimiter}; use rustc_ast::ptr::P; use rustc_ast::token::{self, TokenKind}; use rustc_ast::tokenstream::{DelimSpan, TokenStream, TokenTree}; +use rustc_ast::{self as ast, AttrStyle, AttrVec, Attribute, DUMMY_NODE_ID}; +use rustc_ast::{AssocItem, AssocItemKind, ForeignItemKind, Item, ItemKind, Mod}; +use rustc_ast::{Async, Const, Defaultness, IsAuto, Mutability, Unsafe, UseTree, UseTreeKind}; +use rustc_ast::{BindingMode, Block, FnDecl, FnSig, Param, SelfKind}; +use rustc_ast::{EnumDef, Generics, StructField, TraitRef, Ty, TyKind, Variant, VariantData}; +use rustc_ast::{FnHeader, ForeignItem, Path, PathSegment, Visibility, VisibilityKind}; +use rustc_ast::{MacArgs, MacCall, MacDelimiter}; use rustc_ast_pretty::pprust; use rustc_errors::{struct_span_err, Applicability, PResult, StashKey}; use rustc_span::edition::Edition; diff --git a/src/librustc_parse/parser/mod.rs b/src/librustc_parse/parser/mod.rs index a30131e4f7af4..d67ed74bc9976 100644 --- a/src/librustc_parse/parser/mod.rs +++ b/src/librustc_parse/parser/mod.rs @@ -13,14 +13,12 @@ use crate::lexer::UnmatchedBrace; use diagnostics::Error; pub use path::PathStyle; -use rustc_ast::ast::DUMMY_NODE_ID; -use rustc_ast::ast::{self, AttrStyle, AttrVec, Const, CrateSugar, Extern, Unsafe}; -use rustc_ast::ast::{ - Async, MacArgs, MacDelimiter, Mutability, StrLit, Visibility, VisibilityKind, -}; use rustc_ast::ptr::P; use rustc_ast::token::{self, DelimToken, Token, TokenKind}; use rustc_ast::tokenstream::{self, DelimSpan, TokenStream, TokenTree, TreeAndJoint}; +use rustc_ast::DUMMY_NODE_ID; +use rustc_ast::{self as ast, AttrStyle, AttrVec, Const, CrateSugar, Extern, Unsafe}; +use rustc_ast::{Async, MacArgs, MacDelimiter, Mutability, StrLit, Visibility, VisibilityKind}; use rustc_ast_pretty::pprust; use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, FatalError, PResult}; use rustc_session::parse::ParseSess; diff --git a/src/librustc_parse/parser/pat.rs b/src/librustc_parse/parser/pat.rs index 6603d0afc0248..1d8e6cc9bac64 100644 --- a/src/librustc_parse/parser/pat.rs +++ b/src/librustc_parse/parser/pat.rs @@ -1,10 +1,10 @@ use super::{Parser, PathStyle}; use crate::{maybe_recover_from_interpolated_ty_qpath, maybe_whole}; -use rustc_ast::ast::{self, AttrVec, Attribute, FieldPat, MacCall, Pat, PatKind, RangeEnd}; -use rustc_ast::ast::{BindingMode, Expr, ExprKind, Mutability, Path, QSelf, RangeSyntax}; use rustc_ast::mut_visit::{noop_visit_mac, noop_visit_pat, MutVisitor}; use rustc_ast::ptr::P; use rustc_ast::token; +use rustc_ast::{self as ast, AttrVec, Attribute, FieldPat, MacCall, Pat, PatKind, RangeEnd}; +use rustc_ast::{BindingMode, Expr, ExprKind, Mutability, Path, QSelf, RangeSyntax}; use rustc_ast_pretty::pprust; use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, PResult}; use rustc_span::source_map::{respan, Span, Spanned}; diff --git a/src/librustc_parse/parser/path.rs b/src/librustc_parse/parser/path.rs index 0f2b46f7e1630..54b4df8613f70 100644 --- a/src/librustc_parse/parser/path.rs +++ b/src/librustc_parse/parser/path.rs @@ -1,11 +1,13 @@ use super::ty::{AllowPlus, RecoverQPath}; use super::{Parser, TokenType}; use crate::maybe_whole; -use rustc_ast::ast::{self, AngleBracketedArg, AngleBracketedArgs, GenericArg, ParenthesizedArgs}; -use rustc_ast::ast::{AnonConst, AssocTyConstraint, AssocTyConstraintKind, BlockCheckMode}; -use rustc_ast::ast::{Path, PathSegment, QSelf}; use rustc_ast::ptr::P; use rustc_ast::token::{self, Token}; +use rustc_ast::{ + self as ast, AngleBracketedArg, AngleBracketedArgs, GenericArg, ParenthesizedArgs, +}; +use rustc_ast::{AnonConst, AssocTyConstraint, AssocTyConstraintKind, BlockCheckMode}; +use rustc_ast::{Path, PathSegment, QSelf}; use rustc_errors::{pluralize, Applicability, PResult}; use rustc_span::source_map::{BytePos, Span}; use rustc_span::symbol::{kw, sym, Ident}; diff --git a/src/librustc_parse/parser/stmt.rs b/src/librustc_parse/parser/stmt.rs index 5c3a5e9987324..ac067cb0eab8c 100644 --- a/src/librustc_parse/parser/stmt.rs +++ b/src/librustc_parse/parser/stmt.rs @@ -6,12 +6,12 @@ use super::path::PathStyle; use super::{BlockMode, Parser, Restrictions, SemiColonMode}; use crate::maybe_whole; -use rustc_ast::ast; -use rustc_ast::ast::{AttrStyle, AttrVec, Attribute, MacCall, MacStmtStyle}; -use rustc_ast::ast::{Block, BlockCheckMode, Expr, ExprKind, Local, Stmt, StmtKind, DUMMY_NODE_ID}; +use rustc_ast as ast; use rustc_ast::ptr::P; use rustc_ast::token::{self, TokenKind}; use rustc_ast::util::classify; +use rustc_ast::{AttrStyle, AttrVec, Attribute, MacCall, MacStmtStyle}; +use rustc_ast::{Block, BlockCheckMode, Expr, ExprKind, Local, Stmt, StmtKind, DUMMY_NODE_ID}; use rustc_errors::{Applicability, PResult}; use rustc_span::source_map::{BytePos, Span}; use rustc_span::symbol::{kw, sym}; diff --git a/src/librustc_parse/parser/ty.rs b/src/librustc_parse/parser/ty.rs index cd66b917f232a..4356850818ee8 100644 --- a/src/librustc_parse/parser/ty.rs +++ b/src/librustc_parse/parser/ty.rs @@ -2,11 +2,11 @@ use super::{Parser, PathStyle, TokenType}; use crate::{maybe_recover_from_interpolated_ty_qpath, maybe_whole}; -use rustc_ast::ast::{self, BareFnTy, FnRetTy, GenericParam, Lifetime, MutTy, Ty, TyKind}; -use rustc_ast::ast::{GenericBound, GenericBounds, MacCall, Mutability}; -use rustc_ast::ast::{PolyTraitRef, TraitBoundModifier, TraitObjectSyntax}; use rustc_ast::ptr::P; use rustc_ast::token::{self, Token, TokenKind}; +use rustc_ast::{self as ast, BareFnTy, FnRetTy, GenericParam, Lifetime, MutTy, Ty, TyKind}; +use rustc_ast::{GenericBound, GenericBounds, MacCall, Mutability}; +use rustc_ast::{PolyTraitRef, TraitBoundModifier, TraitObjectSyntax}; use rustc_errors::{pluralize, struct_span_err, Applicability, PResult}; use rustc_span::source_map::Span; use rustc_span::symbol::{kw, sym}; diff --git a/src/librustc_parse/validate_attr.rs b/src/librustc_parse/validate_attr.rs index 2512878ec65be..f4bb96109404a 100644 --- a/src/librustc_parse/validate_attr.rs +++ b/src/librustc_parse/validate_attr.rs @@ -2,8 +2,8 @@ use crate::parse_in; -use rustc_ast::ast::{self, Attribute, MacArgs, MacDelimiter, MetaItem, MetaItemKind}; use rustc_ast::tokenstream::DelimSpan; +use rustc_ast::{self as ast, Attribute, MacArgs, MacDelimiter, MetaItem, MetaItemKind}; use rustc_errors::{Applicability, PResult}; use rustc_feature::{AttributeTemplate, BUILTIN_ATTRIBUTE_MAP}; use rustc_session::lint::builtin::ILL_FORMED_ATTRIBUTE_INPUT; diff --git a/src/librustc_passes/check_attr.rs b/src/librustc_passes/check_attr.rs index d438fe35ff488..59edf21b733c9 100644 --- a/src/librustc_passes/check_attr.rs +++ b/src/librustc_passes/check_attr.rs @@ -8,7 +8,7 @@ use rustc_middle::hir::map::Map; use rustc_middle::ty::query::Providers; use rustc_middle::ty::TyCtxt; -use rustc_ast::ast::{Attribute, NestedMetaItem}; +use rustc_ast::{Attribute, NestedMetaItem}; use rustc_errors::struct_span_err; use rustc_hir as hir; use rustc_hir::def_id::LocalDefId; diff --git a/src/librustc_passes/dead.rs b/src/librustc_passes/dead.rs index 29939c7cfafb0..01da33ddd2e96 100644 --- a/src/librustc_passes/dead.rs +++ b/src/librustc_passes/dead.rs @@ -15,7 +15,7 @@ use rustc_middle::middle::privacy; use rustc_middle::ty::{self, DefIdTree, TyCtxt}; use rustc_session::lint; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_span::symbol::{sym, Symbol}; // Any local node that may call something in its body block should be diff --git a/src/librustc_passes/diagnostic_items.rs b/src/librustc_passes/diagnostic_items.rs index fa59337b0f66b..df0f9f157aedf 100644 --- a/src/librustc_passes/diagnostic_items.rs +++ b/src/librustc_passes/diagnostic_items.rs @@ -9,7 +9,7 @@ //! //! * Compiler internal types like `Ty` and `TyCtxt` -use rustc_ast::ast; +use rustc_ast as ast; use rustc_data_structures::fx::FxHashMap; use rustc_hir as hir; use rustc_hir::def_id::{DefId, LOCAL_CRATE}; diff --git a/src/librustc_passes/hir_stats.rs b/src/librustc_passes/hir_stats.rs index 139ffb9699ad2..9537321026e55 100644 --- a/src/librustc_passes/hir_stats.rs +++ b/src/librustc_passes/hir_stats.rs @@ -2,8 +2,8 @@ // pieces of AST and HIR. The resulting numbers are good approximations but not // completely accurate (some things might be counted twice, others missed). -use rustc_ast::ast::{self, AttrId, NodeId}; use rustc_ast::visit as ast_visit; +use rustc_ast::{self as ast, AttrId, NodeId}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir as hir; use rustc_hir::intravisit as hir_visit; diff --git a/src/librustc_passes/intrinsicck.rs b/src/librustc_passes/intrinsicck.rs index 931a8cb5f7d02..ebe231009d38e 100644 --- a/src/librustc_passes/intrinsicck.rs +++ b/src/librustc_passes/intrinsicck.rs @@ -1,4 +1,4 @@ -use rustc_ast::ast::{FloatTy, InlineAsmTemplatePiece, IntTy, UintTy}; +use rustc_ast::{FloatTy, InlineAsmTemplatePiece, IntTy, UintTy}; use rustc_errors::struct_span_err; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; diff --git a/src/librustc_passes/lang_items.rs b/src/librustc_passes/lang_items.rs index 07415870549f1..4e6136af3af10 100644 --- a/src/librustc_passes/lang_items.rs +++ b/src/librustc_passes/lang_items.rs @@ -13,7 +13,7 @@ use crate::weak_lang_items; use rustc_middle::middle::cstore::ExternCrate; use rustc_middle::ty::TyCtxt; -use rustc_ast::ast::Attribute; +use rustc_ast::Attribute; use rustc_errors::struct_span_err; use rustc_hir as hir; use rustc_hir::def_id::{DefId, LOCAL_CRATE}; diff --git a/src/librustc_passes/layout_test.rs b/src/librustc_passes/layout_test.rs index 9450d75620a8b..504cbbfcb765f 100644 --- a/src/librustc_passes/layout_test.rs +++ b/src/librustc_passes/layout_test.rs @@ -1,4 +1,4 @@ -use rustc_ast::ast::Attribute; +use rustc_ast::Attribute; use rustc_hir as hir; use rustc_hir::def_id::LocalDefId; use rustc_hir::itemlikevisit::ItemLikeVisitor; diff --git a/src/librustc_passes/lib_features.rs b/src/librustc_passes/lib_features.rs index 9a4aa6a68a6c6..7c62a234dbaec 100644 --- a/src/librustc_passes/lib_features.rs +++ b/src/librustc_passes/lib_features.rs @@ -4,7 +4,7 @@ // and `#[unstable (..)]`), but are not declared in one single location // (unlike lang features), which means we need to collect them instead. -use rustc_ast::ast::{Attribute, MetaItem, MetaItemKind}; +use rustc_ast::{Attribute, MetaItem, MetaItemKind}; use rustc_errors::struct_span_err; use rustc_hir::def_id::LOCAL_CRATE; use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor}; diff --git a/src/librustc_passes/liveness.rs b/src/librustc_passes/liveness.rs index 6477f8da008ad..e49863e86d6a2 100644 --- a/src/librustc_passes/liveness.rs +++ b/src/librustc_passes/liveness.rs @@ -84,7 +84,7 @@ use self::LiveNodeKind::*; use self::VarKind::*; -use rustc_ast::ast::InlineAsmOptions; +use rustc_ast::InlineAsmOptions; use rustc_data_structures::fx::FxIndexMap; use rustc_errors::Applicability; use rustc_hir as hir; diff --git a/src/librustc_passes/stability.rs b/src/librustc_passes/stability.rs index 1af77ae61c7f4..91edc7d9db775 100644 --- a/src/librustc_passes/stability.rs +++ b/src/librustc_passes/stability.rs @@ -1,7 +1,7 @@ //! A pass that annotates every item and method with its stability level, //! propagating default levels lexically from parent to children ast nodes. -use rustc_ast::ast::Attribute; +use rustc_ast::Attribute; use rustc_attr::{self as attr, ConstStability, Stability}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::struct_span_err; diff --git a/src/librustc_plugin_impl/load.rs b/src/librustc_plugin_impl/load.rs index 2f307302db03e..687f7db221f4e 100644 --- a/src/librustc_plugin_impl/load.rs +++ b/src/librustc_plugin_impl/load.rs @@ -1,7 +1,7 @@ //! Used by `rustc` when loading a plugin. use crate::Registry; -use rustc_ast::ast::Crate; +use rustc_ast::Crate; use rustc_errors::struct_span_err; use rustc_metadata::locator; use rustc_middle::middle::cstore::MetadataLoader; diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index ddc16d18952ad..761724be57daf 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -15,10 +15,10 @@ use crate::{ }; use crate::{Module, ModuleData, ModuleKind, NameBinding, NameBindingKind, Segment, ToNameBinding}; -use rustc_ast::ast::{self, Block, ForeignItem, ForeignItemKind, Item, ItemKind, NodeId}; -use rustc_ast::ast::{AssocItem, AssocItemKind, MetaItemKind, StmtKind}; use rustc_ast::token::{self, Token}; use rustc_ast::visit::{self, AssocCtxt, Visitor}; +use rustc_ast::{self as ast, Block, ForeignItem, ForeignItemKind, Item, ItemKind, NodeId}; +use rustc_ast::{AssocItem, AssocItemKind, MetaItemKind, StmtKind}; use rustc_ast_lowering::ResolverAstLowering; use rustc_attr as attr; use rustc_data_structures::sync::Lrc; diff --git a/src/librustc_resolve/check_unused.rs b/src/librustc_resolve/check_unused.rs index 1f36e1ed83de7..5624a6b6accc6 100644 --- a/src/librustc_resolve/check_unused.rs +++ b/src/librustc_resolve/check_unused.rs @@ -26,7 +26,7 @@ use crate::imports::ImportKind; use crate::Resolver; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::node_id::NodeMap; use rustc_ast::visit::{self, Visitor}; use rustc_ast_lowering::ResolverAstLowering; diff --git a/src/librustc_resolve/def_collector.rs b/src/librustc_resolve/def_collector.rs index 7dbf51aab28f1..5d5088de31b97 100644 --- a/src/librustc_resolve/def_collector.rs +++ b/src/librustc_resolve/def_collector.rs @@ -1,8 +1,8 @@ use crate::Resolver; -use rustc_ast::ast::*; use rustc_ast::token::{self, Token}; use rustc_ast::visit::{self, FnKind}; use rustc_ast::walk_list; +use rustc_ast::*; use rustc_ast_lowering::ResolverAstLowering; use rustc_expand::expand::AstFragment; use rustc_hir::def_id::LocalDefId; diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 1e5e937db663d..48e1068b8daad 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -1,8 +1,8 @@ use std::cmp::Reverse; use std::ptr; -use rustc_ast::ast::{self, Path}; use rustc_ast::util::lev_distance::find_best_match_for_name; +use rustc_ast::{self as ast, Path}; use rustc_ast_pretty::pprust; use rustc_data_structures::fx::FxHashSet; use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder}; diff --git a/src/librustc_resolve/imports.rs b/src/librustc_resolve/imports.rs index ef51a1c73afdf..b02fc427d6004 100644 --- a/src/librustc_resolve/imports.rs +++ b/src/librustc_resolve/imports.rs @@ -9,9 +9,9 @@ use crate::{BindingKey, ModuleKind, ResolutionError, Resolver, Segment}; use crate::{CrateLint, Module, ModuleOrUniformRoot, ParentScope, PerNS, ScopeSet, Weak}; use crate::{NameBinding, NameBindingKind, PathResult, PrivacyError, ToNameBinding}; -use rustc_ast::ast::NodeId; use rustc_ast::unwrap_or; use rustc_ast::util::lev_distance::find_best_match_for_name; +use rustc_ast::NodeId; use rustc_ast_lowering::ResolverAstLowering; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::ptr_key::PtrKey; diff --git a/src/librustc_resolve/late.rs b/src/librustc_resolve/late.rs index 2f63257a98214..0dbb6269d2eb3 100644 --- a/src/librustc_resolve/late.rs +++ b/src/librustc_resolve/late.rs @@ -11,9 +11,9 @@ use crate::{path_names_to_string, BindingError, CrateLint, LexicalScopeBinding}; use crate::{Module, ModuleOrUniformRoot, NameBindingKind, ParentScope, PathResult}; use crate::{ResolutionError, Resolver, Segment, UseError}; -use rustc_ast::ast::*; use rustc_ast::ptr::P; use rustc_ast::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor}; +use rustc_ast::*; use rustc_ast::{unwrap_or, walk_list}; use rustc_ast_lowering::ResolverAstLowering; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; diff --git a/src/librustc_resolve/late/diagnostics.rs b/src/librustc_resolve/late/diagnostics.rs index 2e606beca26b4..2549aee52ad4b 100644 --- a/src/librustc_resolve/late/diagnostics.rs +++ b/src/librustc_resolve/late/diagnostics.rs @@ -5,9 +5,9 @@ use crate::path_names_to_string; use crate::{CrateLint, Module, ModuleKind, ModuleOrUniformRoot}; use crate::{PathResult, PathSource, Segment}; -use rustc_ast::ast::{self, Expr, ExprKind, Item, ItemKind, NodeId, Path, Ty, TyKind}; use rustc_ast::util::lev_distance::find_best_match_for_name; use rustc_ast::visit::FnKind; +use rustc_ast::{self as ast, Expr, ExprKind, Item, ItemKind, NodeId, Path, Ty, TyKind}; use rustc_data_structures::fx::FxHashSet; use rustc_errors::{pluralize, struct_span_err, Applicability, DiagnosticBuilder}; use rustc_hir as hir; diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 339a5ae6675e7..69bc4827984e1 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -20,12 +20,12 @@ pub use rustc_hir::def::{Namespace, PerNS}; use Determinacy::*; use rustc_arena::TypedArena; -use rustc_ast::ast::{self, FloatTy, IntTy, NodeId, UintTy}; -use rustc_ast::ast::{Crate, CRATE_NODE_ID}; -use rustc_ast::ast::{ItemKind, Path}; use rustc_ast::node_id::NodeMap; use rustc_ast::unwrap_or; use rustc_ast::visit::{self, Visitor}; +use rustc_ast::{self as ast, FloatTy, IntTy, NodeId, UintTy}; +use rustc_ast::{Crate, CRATE_NODE_ID}; +use rustc_ast::{ItemKind, Path}; use rustc_ast_lowering::ResolverAstLowering; use rustc_ast_pretty::pprust; use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap}; diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index 542025ac1f499..51518d63ae901 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -6,7 +6,7 @@ use crate::Namespace::*; use crate::{AmbiguityError, AmbiguityErrorMisc, AmbiguityKind, Determinacy}; use crate::{CrateLint, ParentScope, ResolutionError, Resolver, Scope, ScopeSet, Weak}; use crate::{ModuleKind, ModuleOrUniformRoot, NameBinding, PathResult, Segment, ToNameBinding}; -use rustc_ast::ast::{self, NodeId}; +use rustc_ast::{self as ast, NodeId}; use rustc_ast_lowering::ResolverAstLowering; use rustc_ast_pretty::pprust; use rustc_attr::StabilityLevel; diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index f33d2f46aa269..7f8ac5756dcdc 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -13,7 +13,7 @@ //! DumpVisitor walks the AST and processes it, and Dumper is used for //! recording the output. -use rustc_ast::ast::{self}; +use rustc_ast as ast; use rustc_ast::{token, walk_list}; use rustc_data_structures::fx::FxHashSet; use rustc_hir as hir; diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index ca98ada4e5729..ac066114cd02b 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -9,7 +9,7 @@ mod dumper; mod span_utils; mod sig; -use rustc_ast::ast::{self}; +use rustc_ast as ast; use rustc_ast::util::comments::beautify_doc_string; use rustc_ast_pretty::pprust::attribute_to_string; use rustc_hir as hir; diff --git a/src/librustc_save_analysis/sig.rs b/src/librustc_save_analysis/sig.rs index 33355c4c558fb..b39d0bd773077 100644 --- a/src/librustc_save_analysis/sig.rs +++ b/src/librustc_save_analysis/sig.rs @@ -29,7 +29,7 @@ use crate::{id_from_def_id, id_from_hir_id, SaveContext}; use rls_data::{SigElement, Signature}; -use rustc_ast::ast::Mutability; +use rustc_ast::Mutability; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; use rustc_hir_pretty::id_to_string; diff --git a/src/librustc_session/output.rs b/src/librustc_session/output.rs index e4bce435c4b6d..bf9c96c6c9459 100644 --- a/src/librustc_session/output.rs +++ b/src/librustc_session/output.rs @@ -1,7 +1,7 @@ //! Related to out filenames of compilation (e.g. save analysis, binaries). use crate::config::{CrateType, Input, OutputFilenames, OutputType}; use crate::Session; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_span::symbol::sym; use rustc_span::Span; use std::path::{Path, PathBuf}; diff --git a/src/librustc_session/session.rs b/src/librustc_session/session.rs index f10f9b2ce93c5..d7da2038b549f 100644 --- a/src/librustc_session/session.rs +++ b/src/librustc_session/session.rs @@ -7,9 +7,9 @@ use crate::lint; use crate::parse::ParseSess; use crate::search_paths::{PathKind, SearchPath}; -pub use rustc_ast::ast::Attribute; pub use rustc_ast::attr::MarkedAttrs; pub use rustc_ast::crate_disambiguator::CrateDisambiguator; +pub use rustc_ast::Attribute; use rustc_data_structures::flock; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::jobserver::{self, Client}; diff --git a/src/librustc_symbol_mangling/v0.rs b/src/librustc_symbol_mangling/v0.rs index 56ee492de87ab..f01c3da8b5f10 100644 --- a/src/librustc_symbol_mangling/v0.rs +++ b/src/librustc_symbol_mangling/v0.rs @@ -1,4 +1,4 @@ -use rustc_ast::ast::{FloatTy, IntTy, UintTy}; +use rustc_ast::{FloatTy, IntTy, UintTy}; use rustc_data_structures::base_n; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir as hir; diff --git a/src/librustc_trait_selection/traits/on_unimplemented.rs b/src/librustc_trait_selection/traits/on_unimplemented.rs index 7a9ed4b72dd03..75822eadb2ab3 100644 --- a/src/librustc_trait_selection/traits/on_unimplemented.rs +++ b/src/librustc_trait_selection/traits/on_unimplemented.rs @@ -1,4 +1,4 @@ -use rustc_ast::ast::{MetaItem, NestedMetaItem}; +use rustc_ast::{MetaItem, NestedMetaItem}; use rustc_attr as attr; use rustc_data_structures::fx::FxHashMap; use rustc_errors::{struct_span_err, ErrorReported}; diff --git a/src/librustc_traits/chalk/lowering.rs b/src/librustc_traits/chalk/lowering.rs index 75785076d9ac1..a043fa3f4c845 100644 --- a/src/librustc_traits/chalk/lowering.rs +++ b/src/librustc_traits/chalk/lowering.rs @@ -327,7 +327,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::GoalData>> impl<'tcx> LowerInto<'tcx, chalk_ir::Ty>> for Ty<'tcx> { fn lower_into(self, interner: &RustInterner<'tcx>) -> chalk_ir::Ty> { use chalk_ir::TyData; - use rustc_ast::ast; + use rustc_ast as ast; use TyKind::*; let empty = || chalk_ir::Substitution::empty(interner); diff --git a/src/librustc_traits/chalk/mod.rs b/src/librustc_traits/chalk/mod.rs index 0c5d57551f9c5..f18b4ca65f6f8 100644 --- a/src/librustc_traits/chalk/mod.rs +++ b/src/librustc_traits/chalk/mod.rs @@ -101,7 +101,7 @@ crate fn evaluate_goal<'tcx>( match _data { chalk_ir::GenericArgData::Ty(_t) => { use chalk_ir::TyData; - use rustc_ast::ast; + use rustc_ast as ast; let _data = _t.data(&interner); let kind = match _data { diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 5170a060c5fe0..461fa6c3ec704 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -8,7 +8,7 @@ use crate::collect::PlaceholderHirTyCollector; use crate::middle::resolve_lifetime as rl; use crate::require_c_abi_if_c_variadic; -use rustc_ast::{ast::ParamKindOrd, util::lev_distance::find_best_match_for_name}; +use rustc_ast::{util::lev_distance::find_best_match_for_name, ParamKindOrd}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::ErrorReported; use rustc_errors::{pluralize, struct_span_err, Applicability, DiagnosticId, FatalError}; diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs index 418ea29b84f2f..34693a7321788 100644 --- a/src/librustc_typeck/check/cast.rs +++ b/src/librustc_typeck/check/cast.rs @@ -32,7 +32,7 @@ use super::FnCtxt; use crate::hir::def_id::DefId; use crate::type_error_struct; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, ErrorReported}; use rustc_hir as hir; use rustc_hir::lang_items; diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs index e88f13a1f3ab6..362efd7cd5d5f 100644 --- a/src/librustc_typeck/check/expr.rs +++ b/src/librustc_typeck/check/expr.rs @@ -16,7 +16,7 @@ use crate::check::Needs; use crate::check::TupleArgumentsFlag::DontTupleArguments; use crate::type_error_struct; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::util::lev_distance::find_best_match_for_name; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stack::ensure_sufficient_stack; diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 9078dc40041aa..7ac6681be1a4a 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -7,7 +7,7 @@ use crate::check::FnCtxt; use crate::hir::def::DefKind; use crate::hir::def_id::DefId; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::util::lev_distance::{find_best_match_for_name, lev_distance}; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::sync::Lrc; diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index a625b5ea40567..ed4a3957bcb22 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -88,7 +88,7 @@ pub mod writeback; use crate::astconv::{ AstConv, ExplicitLateBound, GenericArgCountMismatch, GenericArgCountResult, PathSeg, }; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::util::parser::ExprPrecedence; use rustc_attr as attr; use rustc_data_structures::captures::Captures; diff --git a/src/librustc_typeck/check/pat.rs b/src/librustc_typeck/check/pat.rs index 1c78bef98527a..6dac009fb529b 100644 --- a/src/librustc_typeck/check/pat.rs +++ b/src/librustc_typeck/check/pat.rs @@ -1,5 +1,5 @@ use crate::check::FnCtxt; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_ast::util::lev_distance::find_best_match_for_name; use rustc_data_structures::fx::FxHashMap; use rustc_errors::{pluralize, struct_span_err, Applicability, DiagnosticBuilder}; diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 2bde5d2c78cc1..d47a8273d07ea 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -1,7 +1,7 @@ use crate::check::{FnCtxt, Inherited}; use crate::constrained_generic_params::{identify_constrained_generic_params, Parameter}; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder}; use rustc_hir as hir; diff --git a/src/librustc_typeck/coherence/inherent_impls.rs b/src/librustc_typeck/coherence/inherent_impls.rs index cd7429f166f26..859d510dcbec9 100644 --- a/src/librustc_typeck/coherence/inherent_impls.rs +++ b/src/librustc_typeck/coherence/inherent_impls.rs @@ -13,7 +13,7 @@ use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LOCAL_CRATE}; use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_middle::ty::{self, CrateInherentImpls, TyCtxt}; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_span::Span; /// On-demand query: yields a map containing all types mapped to their inherent impls. diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index da1f3ea62f239..a817725f701d0 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -18,8 +18,8 @@ use crate::astconv::{AstConv, Bounds, SizedByDefault}; use crate::check::intrinsic::intrinsic_operation_unsafety; use crate::constrained_generic_params as cgp; use crate::middle::resolve_lifetime as rl; -use rustc_ast::ast; -use rustc_ast::ast::MetaItemKind; +use rustc_ast as ast; +use rustc_ast::MetaItemKind; use rustc_attr::{list_contains_name, InlineAttr, OptimizeAttr}; use rustc_data_structures::captures::Captures; use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet}; @@ -2657,7 +2657,7 @@ fn should_inherit_track_caller(tcx: TyCtxt<'_>, def_id: DefId) -> bool { } fn check_link_ordinal(tcx: TyCtxt<'_>, attr: &ast::Attribute) -> Option { - use rustc_ast::ast::{Lit, LitIntType, LitKind}; + use rustc_ast::{Lit, LitIntType, LitKind}; let meta_item_list = attr.meta_item_list(); let meta_item_list: Option<&[ast::NestedMetaItem]> = meta_item_list.as_ref().map(Vec::as_ref); let sole_meta_list = match meta_item_list { diff --git a/src/librustdoc/clean/cfg.rs b/src/librustdoc/clean/cfg.rs index 53979d27052d3..ab0b332ee1936 100644 --- a/src/librustdoc/clean/cfg.rs +++ b/src/librustdoc/clean/cfg.rs @@ -7,7 +7,7 @@ use std::fmt::{self, Write}; use std::mem; use std::ops; -use rustc_ast::ast::{LitKind, MetaItem, MetaItemKind, NestedMetaItem}; +use rustc_ast::{LitKind, MetaItem, MetaItemKind, NestedMetaItem}; use rustc_feature::Features; use rustc_session::parse::ParseSess; use rustc_span::symbol::{sym, Symbol}; diff --git a/src/librustdoc/clean/cfg/tests.rs b/src/librustdoc/clean/cfg/tests.rs index b4ced412e5e55..96f0a1b7a7cb6 100644 --- a/src/librustdoc/clean/cfg/tests.rs +++ b/src/librustdoc/clean/cfg/tests.rs @@ -1,7 +1,7 @@ use super::*; -use rustc_ast::ast::*; use rustc_ast::attr; +use rustc_ast::Path; use rustc_span::symbol::{Ident, Symbol}; use rustc_span::with_default_session_globals; use rustc_span::DUMMY_SP; diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index cb7c62e3a5ac6..38fa8a402c483 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -2,7 +2,7 @@ use std::iter::once; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_data_structures::fx::FxHashSet; use rustc_hir as hir; use rustc_hir::def::{CtorKind, DefKind, Res}; diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 3ad357e583cf1..123e3b118e819 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -9,7 +9,7 @@ mod simplify; pub mod types; pub mod utils; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_attr as attr; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir as hir; diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 627f88df45c9f..914dc2e1b8847 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -8,9 +8,9 @@ use std::rc::Rc; use std::sync::Arc; use std::{slice, vec}; -use rustc_ast::ast::{self, AttrStyle}; use rustc_ast::attr; use rustc_ast::util::comments::beautify_doc_string; +use rustc_ast::{self as ast, AttrStyle}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir as hir; use rustc_hir::def::Res; @@ -420,7 +420,7 @@ pub struct Attributes { impl Attributes { /// Extracts the content from an attribute `#[doc(cfg(content))]`. pub fn extract_cfg(mi: &ast::MetaItem) -> Option<&ast::MetaItem> { - use rustc_ast::ast::NestedMetaItem::MetaItem; + use rustc_ast::NestedMetaItem::MetaItem; if let ast::MetaItemKind::List(ref nmis) = mi.kind { if nmis.len() == 1 { diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs index 943729a74ab2d..98125adbdea41 100644 --- a/src/librustdoc/doctree.rs +++ b/src/librustdoc/doctree.rs @@ -2,7 +2,7 @@ //! manner (and with prettier names) before cleaning. pub use self::StructType::*; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_span::hygiene::MacroKind; use rustc_span::{self, Span, Symbol}; diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index f7fc3579d67a7..d4d6a8119c316 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -1,4 +1,4 @@ -use rustc_ast::ast; +use rustc_ast as ast; use rustc_errors::{Applicability, DiagnosticBuilder}; use rustc_expand::base::SyntaxExtensionKind; use rustc_feature::UnstableFeatures; @@ -1204,20 +1204,20 @@ fn handle_variant( } const PRIMITIVES: &[(&str, Res)] = &[ - ("u8", Res::PrimTy(hir::PrimTy::Uint(rustc_ast::ast::UintTy::U8))), - ("u16", Res::PrimTy(hir::PrimTy::Uint(rustc_ast::ast::UintTy::U16))), - ("u32", Res::PrimTy(hir::PrimTy::Uint(rustc_ast::ast::UintTy::U32))), - ("u64", Res::PrimTy(hir::PrimTy::Uint(rustc_ast::ast::UintTy::U64))), - ("u128", Res::PrimTy(hir::PrimTy::Uint(rustc_ast::ast::UintTy::U128))), - ("usize", Res::PrimTy(hir::PrimTy::Uint(rustc_ast::ast::UintTy::Usize))), - ("i8", Res::PrimTy(hir::PrimTy::Int(rustc_ast::ast::IntTy::I8))), - ("i16", Res::PrimTy(hir::PrimTy::Int(rustc_ast::ast::IntTy::I16))), - ("i32", Res::PrimTy(hir::PrimTy::Int(rustc_ast::ast::IntTy::I32))), - ("i64", Res::PrimTy(hir::PrimTy::Int(rustc_ast::ast::IntTy::I64))), - ("i128", Res::PrimTy(hir::PrimTy::Int(rustc_ast::ast::IntTy::I128))), - ("isize", Res::PrimTy(hir::PrimTy::Int(rustc_ast::ast::IntTy::Isize))), - ("f32", Res::PrimTy(hir::PrimTy::Float(rustc_ast::ast::FloatTy::F32))), - ("f64", Res::PrimTy(hir::PrimTy::Float(rustc_ast::ast::FloatTy::F64))), + ("u8", Res::PrimTy(hir::PrimTy::Uint(rustc_ast::UintTy::U8))), + ("u16", Res::PrimTy(hir::PrimTy::Uint(rustc_ast::UintTy::U16))), + ("u32", Res::PrimTy(hir::PrimTy::Uint(rustc_ast::UintTy::U32))), + ("u64", Res::PrimTy(hir::PrimTy::Uint(rustc_ast::UintTy::U64))), + ("u128", Res::PrimTy(hir::PrimTy::Uint(rustc_ast::UintTy::U128))), + ("usize", Res::PrimTy(hir::PrimTy::Uint(rustc_ast::UintTy::Usize))), + ("i8", Res::PrimTy(hir::PrimTy::Int(rustc_ast::IntTy::I8))), + ("i16", Res::PrimTy(hir::PrimTy::Int(rustc_ast::IntTy::I16))), + ("i32", Res::PrimTy(hir::PrimTy::Int(rustc_ast::IntTy::I32))), + ("i64", Res::PrimTy(hir::PrimTy::Int(rustc_ast::IntTy::I64))), + ("i128", Res::PrimTy(hir::PrimTy::Int(rustc_ast::IntTy::I128))), + ("isize", Res::PrimTy(hir::PrimTy::Int(rustc_ast::IntTy::Isize))), + ("f32", Res::PrimTy(hir::PrimTy::Float(rustc_ast::FloatTy::F32))), + ("f64", Res::PrimTy(hir::PrimTy::Float(rustc_ast::FloatTy::F64))), ("str", Res::PrimTy(hir::PrimTy::Str)), ("bool", Res::PrimTy(hir::PrimTy::Bool)), ("char", Res::PrimTy(hir::PrimTy::Char)), diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 62f52ea5213f3..693d5b9fb0736 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -1,4 +1,4 @@ -use rustc_ast::ast; +use rustc_ast as ast; use rustc_data_structures::sync::Lrc; use rustc_errors::ErrorReported; use rustc_feature::UnstableFeatures; diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index be80193db8c3b..ac9f839600baf 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -1,7 +1,7 @@ //! The Rust AST Visitor. Extracts useful information and massages it into a form //! usable for `clean`. -use rustc_ast::ast; +use rustc_ast as ast; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; diff --git a/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs b/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs index bb2a4d03734de..8cf8b7a44933a 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs @@ -14,7 +14,7 @@ extern crate rustc_session; use rustc_driver::plugin::Registry; use rustc_lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass}; -use rustc_ast::ast; +use rustc_ast as ast; declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'"); declare_lint_pass!(Pass => [TEST_LINT]); diff --git a/src/test/ui-fulldeps/auxiliary/lint-tool-test.rs b/src/test/ui-fulldeps/auxiliary/lint-tool-test.rs index 8c517e2bb5d54..08b8fb3cbae5a 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-tool-test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-tool-test.rs @@ -12,7 +12,7 @@ extern crate rustc_session; use rustc_driver::plugin::Registry; use rustc_lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintId, LintPass}; -use rustc_ast::ast; +use rustc_ast as ast; declare_tool_lint!(pub clippy::TEST_LINT, Warn, "Warn about stuff"); declare_tool_lint!( /// Some docs diff --git a/src/test/ui-fulldeps/pprust-expr-roundtrip.rs b/src/test/ui-fulldeps/pprust-expr-roundtrip.rs index f0e3ab308e917..8d4101b652624 100644 --- a/src/test/ui-fulldeps/pprust-expr-roundtrip.rs +++ b/src/test/ui-fulldeps/pprust-expr-roundtrip.rs @@ -33,7 +33,7 @@ use rustc_session::parse::ParseSess; use rustc_span::source_map::{Spanned, DUMMY_SP, FileName}; use rustc_span::source_map::FilePathMapping; use rustc_span::symbol::Ident; -use rustc_ast::ast::*; +use rustc_ast::*; use rustc_ast::mut_visit::{self, MutVisitor, visit_clobber}; use rustc_ast::ptr::P; diff --git a/src/test/ui/unboxed-closures/unboxed-closures-unique-type-id.rs b/src/test/ui/unboxed-closures/unboxed-closures-unique-type-id.rs index 9c6be50c5c7bd..4b7016def9d60 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-unique-type-id.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-unique-type-id.rs @@ -4,7 +4,7 @@ // // error: internal compiler error: get_unique_type_id_of_type() - // unexpected type: closure, -// Closure(rustc_ast::ast::DefId{krate: 0, node: 66}, +// Closure(rustc_ast::DefId{krate: 0, node: 66}, // ReScope(63)) // // This is a regression test for issue #17021. diff --git a/src/tools/clippy/clippy_lints/src/attrs.rs b/src/tools/clippy/clippy_lints/src/attrs.rs index 376ac55f9c98c..76ccf2e4bb98b 100644 --- a/src/tools/clippy/clippy_lints/src/attrs.rs +++ b/src/tools/clippy/clippy_lints/src/attrs.rs @@ -5,7 +5,7 @@ use crate::utils::{ span_lint_and_sugg, span_lint_and_then, without_block_comments, }; use if_chain::if_chain; -use rustc_ast::ast::{AttrKind, AttrStyle, Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem}; +use rustc_ast::{AttrKind, AttrStyle, Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem}; use rustc_ast::util::lev_distance::find_best_match_for_name; use rustc_errors::Applicability; use rustc_hir::{ @@ -570,7 +570,7 @@ declare_lint_pass!(EarlyAttributes => [ ]); impl EarlyLintPass for EarlyAttributes { - fn check_item(&mut self, cx: &EarlyContext<'_>, item: &rustc_ast::ast::Item) { + fn check_item(&mut self, cx: &EarlyContext<'_>, item: &rustc_ast::Item) { check_empty_line_after_outer_attr(cx, item); } @@ -580,7 +580,7 @@ impl EarlyLintPass for EarlyAttributes { } } -fn check_empty_line_after_outer_attr(cx: &EarlyContext<'_>, item: &rustc_ast::ast::Item) { +fn check_empty_line_after_outer_attr(cx: &EarlyContext<'_>, item: &rustc_ast::Item) { for attr in &item.attrs { let attr_item = if let AttrKind::Normal(ref attr) = attr.kind { attr diff --git a/src/tools/clippy/clippy_lints/src/lib.rs b/src/tools/clippy/clippy_lints/src/lib.rs index 6ad525d762058..aa1002636406a 100644 --- a/src/tools/clippy/clippy_lints/src/lib.rs +++ b/src/tools/clippy/clippy_lints/src/lib.rs @@ -339,7 +339,7 @@ pub fn register_pre_expansion_lints(store: &mut rustc_lint::LintStore) { } #[doc(hidden)] -pub fn read_conf(args: &[rustc_ast::ast::NestedMetaItem], sess: &Session) -> Conf { +pub fn read_conf(args: &[rustc_ast::NestedMetaItem], sess: &Session) -> Conf { use std::path::Path; match utils::conf::file_from_args(args) { Ok(file_name) => { diff --git a/src/tools/clippy/clippy_lints/src/single_component_path_imports.rs b/src/tools/clippy/clippy_lints/src/single_component_path_imports.rs index 2e853e8301d69..58bfd0bc553f4 100644 --- a/src/tools/clippy/clippy_lints/src/single_component_path_imports.rs +++ b/src/tools/clippy/clippy_lints/src/single_component_path_imports.rs @@ -1,6 +1,6 @@ use crate::utils::{in_macro, span_lint_and_sugg}; use if_chain::if_chain; -use rustc_ast::ast::{Item, ItemKind, UseTreeKind}; +use rustc_ast::{Item, ItemKind, UseTreeKind}; use rustc_errors::Applicability; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/src/tools/clippy/clippy_lints/src/strings.rs b/src/tools/clippy/clippy_lints/src/strings.rs index bada6fa7c522f..7a659bf779c0c 100644 --- a/src/tools/clippy/clippy_lints/src/strings.rs +++ b/src/tools/clippy/clippy_lints/src/strings.rs @@ -161,7 +161,7 @@ declare_lint_pass!(StringLitAsBytes => [STRING_LIT_AS_BYTES]); impl<'tcx> LateLintPass<'tcx> for StringLitAsBytes { fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) { use crate::utils::{snippet, snippet_with_applicability}; - use rustc_ast::ast::LitKind; + use rustc_ast::LitKind; if_chain! { if let ExprKind::MethodCall(path, _, args, _) = &e.kind; diff --git a/src/tools/clippy/clippy_lints/src/transmute.rs b/src/tools/clippy/clippy_lints/src/transmute.rs index 7b5e92eb5ee1b..28fd55f6ff0ad 100644 --- a/src/tools/clippy/clippy_lints/src/transmute.rs +++ b/src/tools/clippy/clippy_lints/src/transmute.rs @@ -3,7 +3,7 @@ use crate::utils::{ span_lint_and_then, sugg, }; use if_chain::if_chain; -use rustc_ast::ast; +use rustc_ast as ast; use rustc_errors::Applicability; use rustc_hir::{Expr, ExprKind, GenericArg, Mutability, QPath, TyKind, UnOp}; use rustc_lint::{LateContext, LateLintPass}; diff --git a/src/tools/clippy/clippy_lints/src/transmuting_null.rs b/src/tools/clippy/clippy_lints/src/transmuting_null.rs index fbf7f0b2517ac..d60306336c6e6 100644 --- a/src/tools/clippy/clippy_lints/src/transmuting_null.rs +++ b/src/tools/clippy/clippy_lints/src/transmuting_null.rs @@ -1,7 +1,7 @@ use crate::consts::{constant_context, Constant}; use crate::utils::{match_qpath, paths, span_lint}; use if_chain::if_chain; -use rustc_ast::ast::LitKind; +use rustc_ast::LitKind; use rustc_hir::{Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_middle::lint::in_external_macro; diff --git a/src/tools/clippy/clippy_lints/src/types.rs b/src/tools/clippy/clippy_lints/src/types.rs index c3dea44752133..a6911da1bb194 100644 --- a/src/tools/clippy/clippy_lints/src/types.rs +++ b/src/tools/clippy/clippy_lints/src/types.rs @@ -5,7 +5,7 @@ use std::cmp::Ordering; use std::collections::BTreeMap; use if_chain::if_chain; -use rustc_ast::ast::{FloatTy, IntTy, LitFloatType, LitIntType, LitKind, UintTy}; +use rustc_ast::{FloatTy, IntTy, LitFloatType, LitIntType, LitKind, UintTy}; use rustc_errors::{Applicability, DiagnosticBuilder}; use rustc_hir as hir; use rustc_hir::intravisit::{walk_body, walk_expr, walk_ty, FnKind, NestedVisitorMap, Visitor}; diff --git a/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs b/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs index 502bf0c427954..b7e2eba0a8178 100644 --- a/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs +++ b/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs @@ -2,7 +2,7 @@ use crate::utils::ast_utils::{eq_field_pat, eq_id, eq_pat, eq_path}; use crate::utils::{over, span_lint_and_then}; -use rustc_ast::ast::{self, Pat, PatKind, PatKind::*, DUMMY_NODE_ID}; +use rustc_ast::{self as ast, Pat, PatKind, PatKind::*, DUMMY_NODE_ID}; use rustc_ast::mut_visit::*; use rustc_ast::ptr::P; use rustc_ast_pretty::pprust; diff --git a/src/tools/clippy/clippy_lints/src/utils/ast_utils.rs b/src/tools/clippy/clippy_lints/src/utils/ast_utils.rs index ad02bc5fd8e7d..c32c80dcd3ce6 100644 --- a/src/tools/clippy/clippy_lints/src/utils/ast_utils.rs +++ b/src/tools/clippy/clippy_lints/src/utils/ast_utils.rs @@ -5,7 +5,7 @@ #![allow(clippy::similar_names, clippy::wildcard_imports, clippy::enum_glob_use)] use crate::utils::{both, over}; -use rustc_ast::ast::{self, *}; +use rustc_ast::{self as ast, *}; use rustc_ast::ptr::P; use rustc_span::symbol::Ident; use std::mem; diff --git a/src/tools/clippy/clippy_lints/src/vec_resize_to_zero.rs b/src/tools/clippy/clippy_lints/src/vec_resize_to_zero.rs index 58e7c354b27da..d2494b321efcd 100644 --- a/src/tools/clippy/clippy_lints/src/vec_resize_to_zero.rs +++ b/src/tools/clippy/clippy_lints/src/vec_resize_to_zero.rs @@ -7,7 +7,7 @@ use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Spanned; use crate::utils::{match_def_path, paths}; -use rustc_ast::ast::LitKind; +use rustc_ast::LitKind; use rustc_hir as hir; declare_clippy_lint! {