Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got rid of repetitions (such as rustc_ast::ast::) in librustc_ast. #70621

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/doc/unstable-book/src/language-features/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extern crate rustc_driver;
use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass,
EarlyLintPassObject, LintArray};
use rustc_driver::plugin::Registry;
use rustc_ast::ast;
use rustc_ast as ast;

declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");

Expand Down
3 changes: 2 additions & 1 deletion src/librustc_ast/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub mod util {
pub mod parser;
}

pub mod ast;
mod ast;
pub mod attr;
pub use attr::{with_default_globals, with_globals, GLOBALS};
pub mod crate_disambiguator;
Expand All @@ -50,6 +50,7 @@ pub mod token;
pub mod tokenstream;
pub mod visit;

pub use crate::ast::*;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};

/// Requirements for a `StableHashingContext` to be used in this crate.
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_ast_lowering/expr.rs
Original file line number Diff line number Diff line change
@@ -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::thin_vec::ThinVec;
use rustc_errors::struct_span_err;
use rustc_hir as hir;
Expand Down Expand Up @@ -839,7 +839,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,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_ast_lowering/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ use super::{AnonymousLifetimeMode, LoweringContext, ParamMode};
use super::{ImplTraitContext, ImplTraitPosition, ImplTraitTypeIdVisitor};
use crate::Arena;

use rustc_ast::ast::*;
use rustc_ast::attr;
use rustc_ast::node_id::NodeMap;
use rustc_ast::ptr::P;
use rustc_ast::visit::{self, AssocCtxt, Visitor};
use rustc_ast::*;
use rustc_errors::struct_span_err;
use rustc_hir as hir;
use rustc_hir::def::{DefKind, Res};
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_ast_lowering/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
#![feature(or_patterns)]
#![recursion_limit = "256"]

use rustc_ast::ast;
use rustc_ast::ast::*;
use rustc_ast as ast;
use rustc_ast::attr;
use rustc_ast::node_id::NodeMap;
use rustc_ast::token::{self, Nonterminal, Token};
use rustc_ast::tokenstream::{TokenStream, TokenTree};
use rustc_ast::visit::{self, AssocCtxt, Visitor};
use rustc_ast::walk_list;
use rustc_ast::*;
use rustc_ast_pretty::pprust;
use rustc_data_structures::captures::Captures;
use rustc_data_structures::fx::FxHashSet;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_ast_lowering/pat.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::{ImplTraitContext, LoweringContext, ParamMode};

use rustc_ast::ast::*;
use rustc_ast::ptr::P;
use rustc_ast::*;
use rustc_hir as hir;
use rustc_hir::def::Res;
use rustc_span::{source_map::Spanned, Span};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_ast_lowering/path.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_ast_passes/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
// This pass is supposed to perform only simple checks not requiring name resolution
// or type checking or some other kind of complex analysis.

use rustc_ast::ast::*;
use rustc_ast::attr;
use rustc_ast::expand::is_proc_macro_attr;
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, struct_span_err, Applicability};
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_ast_passes/feature_gate.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rustc_ast::ast::{self, AssocTyConstraint, AssocTyConstraintKind, NodeId};
use rustc_ast::ast::{GenericParam, GenericParamKind, PatKind, RangeEnd, VariantData};
use rustc_ast::attr;
use rustc_ast::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor};
use rustc_ast::{self as ast, AssocTyConstraint, AssocTyConstraintKind, NodeId};
use rustc_ast::{GenericParam, GenericParamKind, PatKind, RangeEnd, VariantData};
use rustc_errors::{struct_span_err, Handler};
use rustc_feature::{AttributeGate, BUILTIN_ATTRIBUTE_MAP};
use rustc_feature::{Features, GateIssue, UnstableFeatures};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_ast_passes/node_count.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Simply gives a rought count of the number of nodes in an AST.

use rustc_ast::ast::*;
use rustc_ast::visit::*;
use rustc_ast::*;
use rustc_span::Span;

pub struct NodeCounter {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_ast_passes/show_span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
16 changes: 8 additions & 8 deletions src/librustc_ast_pretty/pprust.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
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::attr;
use rustc_ast::ptr::P;
use rustc_ast::token::{self, BinOpToken, DelimToken, Nonterminal, Token, TokenKind};
use rustc_ast::tokenstream::{self, TokenStream, TokenTree};
use rustc_ast::util::parser::{self, AssocOp, Fixity};
use rustc_ast::util::{classify, comments};
use rustc_ast::{self as ast, BlockCheckMode, PatKind, RangeEnd, RangeSyntax};
use rustc_ast::{GenericArg, MacArgs};
use rustc_ast::{GenericBound, SelfKind, TraitBoundModifier};
use rustc_span::edition::Edition;
use rustc_span::source_map::{SourceMap, Spanned};
use rustc_span::symbol::{kw, sym, IdentPrinter};
Expand Down Expand Up @@ -855,7 +855,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);
Expand Down Expand Up @@ -1619,7 +1619,7 @@ impl<'a> State<'a> {
}
}

fn print_expr_vec(&mut self, exprs: &[P<ast::Expr>], attrs: &[Attribute]) {
fn print_expr_vec(&mut self, exprs: &[P<ast::Expr>], attrs: &[ast::Attribute]) {
self.ibox(INDENT_UNIT);
self.s.word("[");
self.print_inner_attributes_inline(attrs);
Expand All @@ -1632,7 +1632,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("[");
Expand All @@ -1649,7 +1649,7 @@ impl<'a> State<'a> {
path: &ast::Path,
fields: &[ast::Field],
wth: &Option<P<ast::Expr>>,
attrs: &[Attribute],
attrs: &[ast::Attribute],
) {
self.print_path(path, true, 0);
self.s.word("{");
Expand Down Expand Up @@ -1689,7 +1689,7 @@ impl<'a> State<'a> {
self.s.word("}");
}

fn print_expr_tup(&mut self, exprs: &[P<ast::Expr>], attrs: &[Attribute]) {
fn print_expr_tup(&mut self, exprs: &[P<ast::Expr>], attrs: &[ast::Attribute]) {
self.popen();
self.print_inner_attributes_inline(attrs);
self.commasep_exprs(Inconsistent, &exprs[..]);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_ast_pretty/pprust/tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::*;

use rustc_ast::ast;
use rustc_ast as ast;
use rustc_ast::with_default_globals;
use rustc_span;
use rustc_span::source_map::respan;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_attr/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use super::{find_by_name, mark_used};

use rustc_ast::ast::{self, Attribute, MetaItem, MetaItemKind, NestedMetaItem};
use rustc_ast::{self as ast, Attribute, MetaItem, MetaItemKind, NestedMetaItem};
use rustc_ast_pretty::pprust;
use rustc_errors::{struct_span_err, Applicability, Handler};
use rustc_feature::{find_gated_cfg, is_builtin_attr_name, Features, GatedCfg};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_builtin_macros/assert.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_builtin_macros/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_builtin_macros/cfg_accessible.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_builtin_macros/cmdline_attrs.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_builtin_macros/concat.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_builtin_macros/concat_idents.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_builtin_macros/deriving/bounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_builtin_macros/deriving/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, Symbol};
use rustc_span::Span;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_builtin_macros/deriving/cmp/eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, Ident, MetaItem};
use rustc_ast::ptr::P;
use rustc_ast::{self as ast, Expr, GenericArg, Ident, MetaItem};
use rustc_expand::base::{Annotatable, ExtCtxt};
use rustc_span::symbol::{sym, Symbol};
use rustc_span::Span;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_builtin_macros/deriving/cmp/ord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
use rustc_span::Span;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_builtin_macros/deriving/cmp/partial_eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_builtin_macros/deriving/cmp/partial_ord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, Symbol};
use rustc_span::Span;
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_builtin_macros/deriving/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use crate::deriving::generic::ty::*;
use crate::deriving::generic::*;
use crate::deriving::path_std;

use rustc_ast::ast::{self, Ident};
use rustc_ast::ast::{Expr, MetaItem};
use rustc_ast::ptr::P;
use rustc_ast::{self as ast, Ident};
use rustc_ast::{Expr, MetaItem};
use rustc_expand::base::{Annotatable, ExtCtxt};
use rustc_span::symbol::sym;
use rustc_span::{Span, DUMMY_SP};
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_builtin_macros/deriving/decodable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ 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 as ast;
use rustc_ast::ptr::P;
use rustc_ast::{Expr, MetaItem, Mutability};
use rustc_expand::base::{Annotatable, ExtCtxt};
use rustc_span::symbol::Symbol;
use rustc_span::Span;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_builtin_macros/deriving/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use crate::deriving::generic::ty::*;
use crate::deriving::generic::*;
use crate::deriving::path_std;

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};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_builtin_macros/deriving/encodable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::Symbol;
use rustc_span::Span;
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_builtin_macros/deriving/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ use std::cell::RefCell;
use std::iter;
use std::vec;

use rustc_ast::ast::{self, BinOpKind, EnumDef, Expr, Generics, Ident, PatKind};
use rustc_ast::ast::{GenericArg, GenericParamKind, VariantData};
use rustc_ast::ptr::P;
use rustc_ast::util::map_in_place::MapInPlace;
use rustc_ast::{self as ast, BinOpKind, EnumDef, Expr, Generics, Ident, PatKind};
use rustc_ast::{GenericArg, GenericParamKind, VariantData};
use rustc_attr as attr;
use rustc_expand::base::{Annotatable, ExtCtxt};
use rustc_session::parse::ParseSess;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_builtin_macros/deriving/generic/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
pub use PtrTy::*;
pub use Ty::*;

use rustc_ast::ast::{self, Expr, GenericArg, GenericParamKind, Generics, Ident, SelfKind};
use rustc_ast::ptr::P;
use rustc_ast::{self as ast, Expr, GenericArg, GenericParamKind, Generics, Ident, SelfKind};
use rustc_expand::base::ExtCtxt;
use rustc_span::source_map::{respan, DUMMY_SP};
use rustc_span::symbol::kw;
Expand Down
Loading