diff --git a/Cargo.lock b/Cargo.lock index beda3993353f4..f639095fae759 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3119,6 +3119,7 @@ dependencies = [ "rustc-rayon", "rustc-rayon-core", "rustc_apfloat", + "rustc_ast", "rustc_attr", "rustc_data_structures", "rustc_errors", @@ -3132,7 +3133,6 @@ dependencies = [ "scoped-tls", "serialize", "smallvec 1.0.0", - "syntax", ] [[package]] @@ -3469,12 +3469,28 @@ dependencies = [ "smallvec 1.0.0", ] +[[package]] +name = "rustc_ast" +version = "0.0.0" +dependencies = [ + "log", + "rustc_data_structures", + "rustc_index", + "rustc_lexer", + "rustc_macros", + "rustc_span", + "scoped-tls", + "serialize", + "smallvec 1.0.0", +] + [[package]] name = "rustc_ast_lowering" version = "0.0.0" dependencies = [ "log", "rustc", + "rustc_ast", "rustc_ast_pretty", "rustc_data_structures", "rustc_errors", @@ -3484,7 +3500,6 @@ dependencies = [ "rustc_span", "rustc_target", "smallvec 1.0.0", - "syntax", ] [[package]] @@ -3492,6 +3507,7 @@ name = "rustc_ast_passes" version = "0.0.0" dependencies = [ "log", + "rustc_ast", "rustc_ast_pretty", "rustc_attr", "rustc_data_structures", @@ -3500,7 +3516,6 @@ dependencies = [ "rustc_parse", "rustc_session", "rustc_span", - "syntax", ] [[package]] @@ -3508,15 +3523,16 @@ name = "rustc_ast_pretty" version = "0.0.0" dependencies = [ "log", + "rustc_ast", "rustc_data_structures", "rustc_span", - "syntax", ] [[package]] name = "rustc_attr" version = "0.0.0" dependencies = [ + "rustc_ast", "rustc_ast_pretty", "rustc_data_structures", "rustc_errors", @@ -3526,7 +3542,6 @@ dependencies = [ "rustc_span", "serialize", "smallvec 1.0.0", - "syntax", ] [[package]] @@ -3535,6 +3550,7 @@ version = "0.0.0" dependencies = [ "fmt_macros", "log", + "rustc_ast", "rustc_ast_pretty", "rustc_attr", "rustc_data_structures", @@ -3546,7 +3562,6 @@ dependencies = [ "rustc_span", "rustc_target", "smallvec 1.0.0", - "syntax", ] [[package]] @@ -3560,6 +3575,7 @@ dependencies = [ "measureme", "rustc", "rustc-demangle", + "rustc_ast", "rustc_attr", "rustc_codegen_ssa", "rustc_codegen_utils", @@ -3576,7 +3592,6 @@ dependencies = [ "rustc_target", "serialize", "smallvec 1.0.0", - "syntax", ] [[package]] @@ -3592,6 +3607,7 @@ dependencies = [ "num_cpus", "rustc", "rustc_apfloat", + "rustc_ast", "rustc_attr", "rustc_codegen_utils", "rustc_data_structures", @@ -3604,7 +3620,6 @@ dependencies = [ "rustc_span", "rustc_target", "serialize", - "syntax", "tempfile", ] @@ -3616,12 +3631,12 @@ dependencies = [ "punycode", "rustc", "rustc-demangle", + "rustc_ast", "rustc_data_structures", "rustc_hir", "rustc_metadata", "rustc_span", "rustc_target", - "syntax", ] [[package]] @@ -3657,6 +3672,7 @@ dependencies = [ "lazy_static 1.4.0", "log", "rustc", + "rustc_ast", "rustc_ast_pretty", "rustc_codegen_ssa", "rustc_codegen_utils", @@ -3675,7 +3691,6 @@ dependencies = [ "rustc_span", "rustc_target", "serialize", - "syntax", "winapi 0.3.8", ] @@ -3704,6 +3719,7 @@ name = "rustc_expand" version = "0.0.0" dependencies = [ "log", + "rustc_ast", "rustc_ast_passes", "rustc_ast_pretty", "rustc_attr", @@ -3716,7 +3732,6 @@ dependencies = [ "rustc_span", "serialize", "smallvec 1.0.0", - "syntax", ] [[package]] @@ -3737,6 +3752,7 @@ name = "rustc_hir" version = "0.0.0" dependencies = [ "lazy_static 1.4.0", + "rustc_ast", "rustc_ast_pretty", "rustc_data_structures", "rustc_errors", @@ -3746,7 +3762,6 @@ dependencies = [ "rustc_target", "serialize", "smallvec 1.0.0", - "syntax", ] [[package]] @@ -3757,13 +3772,13 @@ dependencies = [ "log", "rand 0.7.3", "rustc", + "rustc_ast", "rustc_data_structures", "rustc_fs_util", "rustc_hir", "rustc_session", "rustc_span", "serialize", - "syntax", ] [[package]] @@ -3782,6 +3797,7 @@ dependencies = [ "graphviz", "log", "rustc", + "rustc_ast", "rustc_attr", "rustc_data_structures", "rustc_error_codes", @@ -3793,7 +3809,6 @@ dependencies = [ "rustc_span", "rustc_target", "smallvec 1.0.0", - "syntax", ] [[package]] @@ -3804,6 +3819,7 @@ dependencies = [ "once_cell", "rustc", "rustc-rayon", + "rustc_ast", "rustc_ast_lowering", "rustc_ast_passes", "rustc_attr", @@ -3834,7 +3850,6 @@ dependencies = [ "rustc_typeck", "serialize", "smallvec 1.0.0", - "syntax", "tempfile", "winapi 0.3.8", ] @@ -3852,6 +3867,7 @@ version = "0.0.0" dependencies = [ "log", "rustc", + "rustc_ast", "rustc_ast_pretty", "rustc_attr", "rustc_data_structures", @@ -3863,7 +3879,6 @@ dependencies = [ "rustc_session", "rustc_span", "rustc_target", - "syntax", "unicode-security", ] @@ -3894,6 +3909,7 @@ dependencies = [ "log", "memmap", "rustc", + "rustc_ast", "rustc_ast_pretty", "rustc_attr", "rustc_data_structures", @@ -3907,7 +3923,6 @@ dependencies = [ "serialize", "smallvec 1.0.0", "stable_deref_trait", - "syntax", "winapi 0.3.8", ] @@ -3923,6 +3938,7 @@ dependencies = [ "polonius-engine", "rustc", "rustc_apfloat", + "rustc_ast", "rustc_ast_pretty", "rustc_attr", "rustc_data_structures", @@ -3936,7 +3952,6 @@ dependencies = [ "rustc_target", "serialize", "smallvec 1.0.0", - "syntax", ] [[package]] @@ -3947,6 +3962,7 @@ dependencies = [ "log", "rustc", "rustc_apfloat", + "rustc_ast", "rustc_attr", "rustc_data_structures", "rustc_errors", @@ -3959,7 +3975,6 @@ dependencies = [ "rustc_target", "serialize", "smallvec 1.0.0", - "syntax", ] [[package]] @@ -3968,6 +3983,7 @@ version = "0.0.0" dependencies = [ "bitflags", "log", + "rustc_ast", "rustc_ast_pretty", "rustc_attr", "rustc_data_structures", @@ -3977,7 +3993,6 @@ dependencies = [ "rustc_session", "rustc_span", "smallvec 1.0.0", - "syntax", "unicode-normalization", ] @@ -3987,6 +4002,7 @@ version = "0.0.0" dependencies = [ "log", "rustc", + "rustc_ast", "rustc_attr", "rustc_data_structures", "rustc_errors", @@ -3997,7 +4013,6 @@ dependencies = [ "rustc_session", "rustc_span", "rustc_target", - "syntax", ] [[package]] @@ -4005,12 +4020,12 @@ name = "rustc_plugin_impl" version = "0.0.0" dependencies = [ "rustc", + "rustc_ast", "rustc_errors", "rustc_hir", "rustc_lint", "rustc_metadata", "rustc_span", - "syntax", ] [[package]] @@ -4019,13 +4034,13 @@ version = "0.0.0" dependencies = [ "log", "rustc", + "rustc_ast", "rustc_attr", "rustc_data_structures", "rustc_errors", "rustc_hir", "rustc_span", "rustc_typeck", - "syntax", ] [[package]] @@ -4036,6 +4051,7 @@ dependencies = [ "bitflags", "log", "rustc", + "rustc_ast", "rustc_ast_lowering", "rustc_ast_pretty", "rustc_attr", @@ -4049,7 +4065,6 @@ dependencies = [ "rustc_session", "rustc_span", "smallvec 1.0.0", - "syntax", ] [[package]] @@ -4060,6 +4075,7 @@ dependencies = [ "rls-data", "rls-span", "rustc", + "rustc_ast", "rustc_ast_pretty", "rustc_codegen_utils", "rustc_data_structures", @@ -4067,7 +4083,6 @@ dependencies = [ "rustc_parse", "rustc_span", "serde_json", - "syntax", ] [[package]] @@ -4076,6 +4091,7 @@ version = "0.0.0" dependencies = [ "log", "num_cpus", + "rustc_ast", "rustc_data_structures", "rustc_errors", "rustc_feature", @@ -4084,7 +4100,6 @@ dependencies = [ "rustc_span", "rustc_target", "serialize", - "syntax", ] [[package]] @@ -4132,6 +4147,7 @@ dependencies = [ "chalk-engine", "log", "rustc", + "rustc_ast", "rustc_data_structures", "rustc_hir", "rustc_infer", @@ -4139,7 +4155,6 @@ dependencies = [ "rustc_span", "rustc_target", "smallvec 1.0.0", - "syntax", ] [[package]] @@ -4162,6 +4177,7 @@ dependencies = [ "arena", "log", "rustc", + "rustc_ast", "rustc_attr", "rustc_data_structures", "rustc_errors", @@ -4171,7 +4187,6 @@ dependencies = [ "rustc_span", "rustc_target", "smallvec 1.0.0", - "syntax", ] [[package]] @@ -4683,21 +4698,6 @@ dependencies = [ "unicode-xid 0.2.0", ] -[[package]] -name = "syntax" -version = "0.0.0" -dependencies = [ - "log", - "rustc_data_structures", - "rustc_index", - "rustc_lexer", - "rustc_macros", - "rustc_span", - "scoped-tls", - "serialize", - "smallvec 1.0.0", -] - [[package]] name = "tar" version = "0.4.26" diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 8003d8906e824..b828d56b98e4b 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -996,7 +996,7 @@ impl Step for Src { "src/tools/rustc-std-workspace-alloc", "src/tools/rustc-std-workspace-std", "src/librustc", - "src/libsyntax", + "src/librustc_ast", ]; copy_src_dirs(builder, &std_src_dirs[..], &[], &dst_src); diff --git a/src/doc/rustc-ux-guidelines.md b/src/doc/rustc-ux-guidelines.md index dfd8e9db3c5c9..b626923bcb59c 100644 --- a/src/doc/rustc-ux-guidelines.md +++ b/src/doc/rustc-ux-guidelines.md @@ -62,7 +62,7 @@ for details on how to format and write long error codes. * All of them are accessible [online](http://doc.rust-lang.org/error-index.html), which are auto-generated from rustc source code in different places: [librustc](https://github.com/rust-lang/rust/blob/master/src/librustc/error_codes.rs), - [libsyntax](https://github.com/rust-lang/rust/blob/master/src/libsyntax/error_codes.rs), + [librustc_ast](https://github.com/rust-lang/rust/blob/master/src/librustc_ast/error_codes.rs), [librustc_borrowck](https://github.com/rust-lang/rust/blob/master/src/librustc_borrowck/error_codes.rs), [librustc_metadata](https://github.com/rust-lang/rust/blob/master/src/librustc_metadata/error_codes.rs), [librustc_mir](https://github.com/rust-lang/rust/blob/master/src/librustc_mir/error_codes.rs), diff --git a/src/doc/unstable-book/src/language-features/plugin.md b/src/doc/unstable-book/src/language-features/plugin.md index 495cdee62c87d..47ac986c224a9 100644 --- a/src/doc/unstable-book/src/language-features/plugin.md +++ b/src/doc/unstable-book/src/language-features/plugin.md @@ -23,7 +23,7 @@ mechanics of defining and loading a plugin. In the vast majority of cases, a plugin should *only* be used through `#![plugin]` and not through an `extern crate` item. Linking a plugin would -pull in all of libsyntax and librustc as dependencies of your crate. This is +pull in all of librustc_ast and librustc as dependencies of your crate. This is generally unwanted unless you are building another plugin. The usual practice is to put compiler plugins in their own crate, separate from @@ -42,7 +42,7 @@ that warns about any item named `lintme`. #![feature(plugin_registrar)] #![feature(box_syntax, rustc_private)] -extern crate syntax; +extern crate rustc_ast; // Load rustc as a plugin to get macros #[macro_use] @@ -52,7 +52,7 @@ extern crate rustc_driver; use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass, EarlyLintPassObject, LintArray}; use rustc_driver::plugin::Registry; -use syntax::ast; +use rustc_ast::ast; declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'"); diff --git a/src/librustc/Cargo.toml b/src/librustc/Cargo.toml index af2be30cc0a86..bac2540ab450a 100644 --- a/src/librustc/Cargo.toml +++ b/src/librustc/Cargo.toml @@ -28,7 +28,7 @@ rustc_data_structures = { path = "../librustc_data_structures" } rustc_errors = { path = "../librustc_errors" } rustc_index = { path = "../librustc_index" } rustc_serialize = { path = "../libserialize", package = "serialize" } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } rustc_span = { path = "../librustc_span" } backtrace = "0.3.40" parking_lot = "0.9" diff --git a/src/librustc/arena.rs b/src/librustc/arena.rs index 16920947c800b..0384a9f781578 100644 --- a/src/librustc/arena.rs +++ b/src/librustc/arena.rs @@ -131,7 +131,7 @@ macro_rules! arena_types { // HIR types [few] hir_krate: rustc_hir::Crate<$tcx>, [] arm: rustc_hir::Arm<$tcx>, - [] attribute: syntax::ast::Attribute, + [] attribute: rustc_ast::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/dep_graph/safe.rs b/src/librustc/dep_graph/safe.rs index 23aef0c429830..74e32867cdec1 100644 --- a/src/librustc/dep_graph/safe.rs +++ b/src/librustc/dep_graph/safe.rs @@ -2,9 +2,9 @@ use crate::ty::TyCtxt; +use rustc_ast::ast::NodeId; use rustc_hir::def_id::DefId; use rustc_hir::BodyId; -use syntax::ast::NodeId; /// The `DepGraphSafe` trait is used to specify what kinds of values /// are safe to "leak" into a task. The idea is that this should be diff --git a/src/librustc/hir/exports.rs b/src/librustc/hir/exports.rs index db020e39e8eda..4c144a54d6345 100644 --- a/src/librustc/hir/exports.rs +++ b/src/librustc/hir/exports.rs @@ -1,10 +1,10 @@ use crate::ty; +use rustc_ast::ast; use rustc_hir::def::Res; use rustc_hir::def_id::DefIdMap; use rustc_macros::HashStable; use rustc_span::Span; -use syntax::ast; use std::fmt::Debug; diff --git a/src/librustc/hir/map/blocks.rs b/src/librustc/hir/map/blocks.rs index 016fc939a7a17..618f9a018d1e7 100644 --- a/src/librustc/hir/map/blocks.rs +++ b/src/librustc/hir/map/blocks.rs @@ -12,11 +12,11 @@ //! for the `Code` associated with a particular NodeId. use crate::hir::map::Map; +use rustc_ast::ast::{Attribute, Ident}; use rustc_hir as hir; use rustc_hir::intravisit::FnKind; use rustc_hir::{Expr, FnDecl, Node}; use rustc_span::Span; -use syntax::ast::{Attribute, Ident}; /// An FnLikeNode is a Node that is like a fn, in that it has a decl /// and a body (as well as a NodeId, a span, etc). diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs index bf1fc09649a58..ebd335ab35504 100644 --- a/src/librustc/hir/map/collector.rs +++ b/src/librustc/hir/map/collector.rs @@ -3,6 +3,7 @@ use crate::hir::map::definitions::{self, DefPathHash}; use crate::hir::map::{Entry, HirEntryMap, Map}; use crate::ich::StableHashingContext; use crate::middle::cstore::CrateStore; +use rustc_ast::ast::NodeId; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; @@ -16,7 +17,6 @@ use rustc_index::vec::IndexVec; use rustc_session::{CrateDisambiguator, Session}; use rustc_span::source_map::SourceMap; use rustc_span::{Span, Symbol, DUMMY_SP}; -use syntax::ast::NodeId; use std::iter::repeat; diff --git a/src/librustc/hir/map/definitions.rs b/src/librustc/hir/map/definitions.rs index 048c1f026be82..047ce8b8445fd 100644 --- a/src/librustc/hir/map/definitions.rs +++ b/src/librustc/hir/map/definitions.rs @@ -4,6 +4,8 @@ //! There are also some rather random cases (like const initializer //! expressions) that are mostly just leftovers. +use rustc_ast::ast; +use rustc_ast::node_id::NodeMap; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stable_hasher::StableHasher; @@ -14,8 +16,6 @@ use rustc_session::CrateDisambiguator; use rustc_span::hygiene::ExpnId; use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; -use syntax::ast; -use syntax::node_id::NodeMap; use std::borrow::Borrow; use std::fmt::Write; diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index f7301280acd69..b208826560512 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -6,6 +6,7 @@ pub use self::definitions::{ use crate::dep_graph::{DepGraph, DepKind, DepNode, DepNodeIndex}; use crate::middle::cstore::CrateStoreDyn; use crate::ty::query::Providers; +use rustc_ast::ast::{self, Name, NodeId}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::svh::Svh; use rustc_hir::def::{DefKind, Res}; @@ -20,7 +21,6 @@ use rustc_span::source_map::Spanned; use rustc_span::symbol::kw; use rustc_span::Span; use rustc_target::spec::abi::Abi; -use syntax::ast::{self, Name, NodeId}; pub mod blocks; mod collector; diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs index 2cb8388aca63f..d421da6d7521c 100644 --- a/src/librustc/ich/hcx.rs +++ b/src/librustc/ich/hcx.rs @@ -5,6 +5,7 @@ use crate::middle::cstore::CrateStore; use crate::session::Session; use crate::ty::{fast_reject, TyCtxt}; +use rustc_ast::ast; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey}; use rustc_data_structures::sync::Lrc; @@ -13,7 +14,6 @@ use rustc_hir::def_id::{DefId, DefIndex}; use rustc_span::source_map::SourceMap; use rustc_span::symbol::Symbol; use rustc_span::{BytePos, SourceFile}; -use syntax::ast; use smallvec::SmallVec; use std::cmp::Ord; diff --git a/src/librustc/ich/impls_syntax.rs b/src/librustc/ich/impls_syntax.rs index 889c8f3aca05e..daff8a0f1825e 100644 --- a/src/librustc/ich/impls_syntax.rs +++ b/src/librustc/ich/impls_syntax.rs @@ -1,12 +1,12 @@ //! This module contains `HashStable` implementations for various data types -//! from libsyntax in no particular order. +//! from librustc_ast in no particular order. use crate::ich::StableHashingContext; +use rustc_ast::ast; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX}; use rustc_span::SourceFile; -use syntax::ast; use smallvec::SmallVec; @@ -35,7 +35,7 @@ impl<'a> HashStable> for [ast::Attribute] { } } -impl<'ctx> syntax::HashStableContext for StableHashingContext<'ctx> { +impl<'ctx> rustc_ast::HashStableContext for StableHashingContext<'ctx> { fn hash_attr(&mut self, attr: &ast::Attribute, hasher: &mut StableHasher) { // Make sure that these have been filtered out. debug_assert!(!attr.ident().map_or(false, |ident| self.is_ignored_attr(ident.name))); diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs index 0e7ff3a3393ef..624bd9340987d 100644 --- a/src/librustc/middle/cstore.rs +++ b/src/librustc/middle/cstore.rs @@ -8,6 +8,8 @@ use crate::session::search_paths::PathKind; use crate::session::CrateDisambiguator; use crate::ty::TyCtxt; +use rustc_ast::ast; +use rustc_ast::expand::allocator::AllocatorKind; use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::{self, MetadataRef}; use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; @@ -17,8 +19,6 @@ use rustc_span::Span; use rustc_target::spec::Target; use std::any::Any; use std::path::{Path, PathBuf}; -use syntax::ast; -use syntax::expand::allocator::AllocatorKind; pub use self::NativeLibraryKind::*; pub use rustc_session::utils::NativeLibraryKind; diff --git a/src/librustc/middle/recursion_limit.rs b/src/librustc/middle/recursion_limit.rs index be530da5910df..ae31a2cc63da6 100644 --- a/src/librustc/middle/recursion_limit.rs +++ b/src/librustc/middle/recursion_limit.rs @@ -8,8 +8,8 @@ use crate::session::Session; use core::num::IntErrorKind; use rustc::bug; +use rustc_ast::ast; use rustc_span::symbol::{sym, Symbol}; -use syntax::ast; use rustc_data_structures::sync::Once; diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index 7b5faa2423aea..9d3df9623bd62 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -5,6 +5,7 @@ pub use self::StabilityLevel::*; use crate::session::{DiagnosticMessageId, Session}; use crate::ty::{self, TyCtxt}; +use rustc_ast::ast::CRATE_NODE_ID; use rustc_attr::{self as attr, ConstStability, Deprecation, RustcDeprecation, Stability}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::{Applicability, DiagnosticBuilder}; @@ -18,7 +19,6 @@ use rustc_session::lint::{BuiltinLintDiagnostics, Lint, LintBuffer}; use rustc_session::parse::feature_err_issue; use rustc_span::symbol::{sym, Symbol}; use rustc_span::{MultiSpan, Span}; -use syntax::ast::CRATE_NODE_ID; use std::num::NonZeroU32; diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs index 0d0aa8a232e69..d3efe62e8c153 100644 --- a/src/librustc/mir/interpret/allocation.rs +++ b/src/librustc/mir/interpret/allocation.rs @@ -6,12 +6,12 @@ use super::{ use crate::ty::layout::{Align, Size}; +use rustc_ast::ast::Mutability; use rustc_data_structures::sorted_map::SortedMap; use rustc_target::abi::HasDataLayout; use std::borrow::Cow; use std::iter; use std::ops::{Deref, DerefMut, Range}; -use syntax::ast::Mutability; // NOTE: When adding new fields, make sure to adjust the `Snapshot` impl in // `src/librustc_mir/interpret/snapshot.rs`. diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs index c62f9a049a050..64c07b431db38 100644 --- a/src/librustc/mir/interpret/mod.rs +++ b/src/librustc/mir/interpret/mod.rs @@ -107,6 +107,7 @@ use crate::ty::layout::{self, Size}; use crate::ty::subst::GenericArgKind; use crate::ty::{self, Instance, Ty, TyCtxt}; use byteorder::{BigEndian, LittleEndian, ReadBytesExt, WriteBytesExt}; +use rustc_ast::ast::LitKind; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::{HashMapExt, Lock}; use rustc_data_structures::tiny_list::TinyList; @@ -117,7 +118,6 @@ use std::fmt; use std::io; use std::num::NonZeroU32; use std::sync::atomic::{AtomicU32, Ordering}; -use syntax::ast::LitKind; /// Uniquely identifies one of the following: /// - A constant diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index a415c72d0ba46..668240ab42b4c 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -18,6 +18,8 @@ use rustc_hir::def_id::DefId; use rustc_hir::{self, GeneratorKind}; use polonius_engine::Atom; +pub use rustc_ast::ast::Mutability; +use rustc_ast::ast::Name; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::graph::dominators::Dominators; use rustc_data_structures::graph::{self, GraphSuccessors}; @@ -32,8 +34,6 @@ use std::fmt::{self, Debug, Display, Formatter, Write}; use std::ops::Index; use std::slice; use std::{iter, mem, option, u32}; -pub use syntax::ast::Mutability; -use syntax::ast::Name; pub use self::cache::{BodyAndCache, ReadOnlyBodyAndCache}; pub use self::query::*; diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index 77c612cf34abd..1a4ea66a5f1d9 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -13,11 +13,11 @@ use crate::ty::fold::{TypeFolder, TypeVisitor}; use crate::ty::subst::SubstsRef; use crate::ty::{self, AdtKind, List, Ty, TyCtxt}; +use rustc_ast::ast; use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_span::{Span, DUMMY_SP}; use smallvec::SmallVec; -use syntax::ast; use std::borrow::Cow; use std::fmt::Debug; diff --git a/src/librustc/traits/specialization_graph.rs b/src/librustc/traits/specialization_graph.rs index ee813bf606e97..d481e578fc1dd 100644 --- a/src/librustc/traits/specialization_graph.rs +++ b/src/librustc/traits/specialization_graph.rs @@ -1,10 +1,10 @@ use crate::ich::{self, StableHashingContext}; use crate::ty::fast_reject::SimplifiedType; use crate::ty::{self, TyCtxt}; +use rustc_ast::ast::Ident; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_hir::def_id::{DefId, DefIdMap}; -use syntax::ast::Ident; /// A per-trait graph of impls in specialization order. At the moment, this /// graph forms a tree rooted with the trait itself, with all other nodes diff --git a/src/librustc/ty/cast.rs b/src/librustc/ty/cast.rs index 5ba3f80b82296..31c106cb230b4 100644 --- a/src/librustc/ty/cast.rs +++ b/src/librustc/ty/cast.rs @@ -3,8 +3,8 @@ use crate::ty::{self, Ty}; +use rustc_ast::ast; use rustc_macros::HashStable; -use syntax::ast; /// Types that are represented as ints. #[derive(Copy, Clone, Debug, PartialEq, Eq)] diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index befae4195f3b3..d2108517a0668 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -42,6 +42,9 @@ use crate::ty::{InferConst, ParamConst}; use crate::ty::{List, TyKind, TyS}; use crate::util::common::ErrorReported; use rustc::lint::LintDiagnosticBuilder; +use rustc_ast::ast; +use rustc_ast::expand::allocator::AllocatorKind; +use rustc_ast::node_id::NodeMap; use rustc_attr as attr; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::profiling::SelfProfilerRef; @@ -65,9 +68,6 @@ use rustc_span::source_map::MultiSpan; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::Span; use rustc_target::spec::abi; -use syntax::ast; -use syntax::expand::allocator::AllocatorKind; -use syntax::node_id::NodeMap; use smallvec::SmallVec; use std::any::Any; @@ -1720,7 +1720,7 @@ pub mod tls { set_tlv(context as *const _ as usize, || f(&context)) } - /// Enters `GlobalCtxt` by setting up libsyntax callbacks and + /// Enters `GlobalCtxt` by setting up librustc_ast callbacks and /// creating a initial `TyCtxt` and `ImplicitCtxt`. /// This happens once per rustc session and `TyCtxt`s only exists /// inside the `f` function. diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs index 2599ad8ba7b9d..d0bc0d5fabfae 100644 --- a/src/librustc/ty/error.rs +++ b/src/librustc/ty/error.rs @@ -1,10 +1,10 @@ use crate::ty::{self, BoundRegion, Region, Ty, TyCtxt}; +use rustc_ast::ast; use rustc_errors::{pluralize, Applicability, DiagnosticBuilder}; use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_span::Span; use rustc_target::spec::abi; -use syntax::ast; use std::borrow::Cow; use std::fmt; diff --git a/src/librustc/ty/fast_reject.rs b/src/librustc/ty/fast_reject.rs index 5aa8bd9df2aef..2a937d6581d6a 100644 --- a/src/librustc/ty/fast_reject.rs +++ b/src/librustc/ty/fast_reject.rs @@ -1,11 +1,11 @@ use crate::ich::StableHashingContext; use crate::ty::{self, Ty, TyCtxt}; +use rustc_ast::ast; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_hir::def_id::DefId; use std::fmt::Debug; use std::hash::Hash; use std::mem; -use syntax::ast; use self::SimplifiedTypeGen::*; diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index cb98ff4c9e5cb..a8266f405cb8e 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -1,9 +1,9 @@ use crate::session::{self, DataTypeKind}; use crate::ty::{self, subst::SubstsRef, ReprOptions, Ty, TyCtxt, TypeFoldable}; +use rustc_ast::ast::{self, Ident, IntTy, UintTy}; use rustc_attr as attr; use rustc_span::DUMMY_SP; -use syntax::ast::{self, Ident, IntTy, UintTy}; use std::cmp; use std::fmt; diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 4c7046781c100..89ff0b2a0ccbc 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -26,6 +26,8 @@ use crate::ty::layout::VariantIdx; use crate::ty::subst::{InternalSubsts, Subst, SubstsRef}; use crate::ty::util::{Discr, IntTypeExt}; use crate::ty::walk::TypeWalker; +use rustc_ast::ast::{self, Ident, Name}; +use rustc_ast::node_id::{NodeId, NodeMap, NodeSet}; use rustc_attr as attr; use rustc_data_structures::captures::Captures; use rustc_data_structures::fx::FxHashMap; @@ -44,8 +46,6 @@ use rustc_span::hygiene::ExpnId; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::Span; use rustc_target::abi::Align; -use syntax::ast::{self, Ident, Name}; -use syntax::node_id::{NodeId, NodeMap, NodeSet}; use std::cell::RefCell; use std::cmp::{self, Ordering}; diff --git a/src/librustc/ty/print/pretty.rs b/src/librustc/ty/print/pretty.rs index 3512b24ec4877..3bf92552c8624 100644 --- a/src/librustc/ty/print/pretty.rs +++ b/src/librustc/ty/print/pretty.rs @@ -11,10 +11,10 @@ use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc_apfloat::ieee::{Double, Single}; use rustc_apfloat::Float; +use rustc_ast::ast; use rustc_attr::{SignedInt, UnsignedInt}; use rustc_span::symbol::{kw, Symbol}; use rustc_target::spec::abi::Abi; -use syntax::ast; use std::cell::Cell; use std::collections::BTreeMap; diff --git a/src/librustc/ty/query/job.rs b/src/librustc/ty/query/job.rs index 3394fed840222..4e88fc5463794 100644 --- a/src/librustc/ty/query/job.rs +++ b/src/librustc/ty/query/job.rs @@ -535,11 +535,11 @@ pub unsafe fn handle_deadlock() { let rustc_span_globals = rustc_span::GLOBALS.with(|rustc_span_globals| rustc_span_globals as *const _); let rustc_span_globals = &*rustc_span_globals; - let syntax_globals = syntax::attr::GLOBALS.with(|syntax_globals| syntax_globals as *const _); + let syntax_globals = rustc_ast::attr::GLOBALS.with(|syntax_globals| syntax_globals as *const _); let syntax_globals = &*syntax_globals; thread::spawn(move || { tls::GCX_PTR.set(gcx_ptr, || { - syntax::attr::GLOBALS.set(syntax_globals, || { + rustc_ast::attr::GLOBALS.set(syntax_globals, || { rustc_span::GLOBALS .set(rustc_span_globals, || tls::with_global(|tcx| deadlock(tcx, ®istry))) }); diff --git a/src/librustc/ty/query/mod.rs b/src/librustc/ty/query/mod.rs index 381a7b1f03ff7..8614fd5cdca9a 100644 --- a/src/librustc/ty/query/mod.rs +++ b/src/librustc/ty/query/mod.rs @@ -49,6 +49,7 @@ use rustc_hir::{Crate, HirIdSet, ItemLocalId, TraitCandidate}; use rustc_index::vec::IndexVec; use rustc_target::spec::PanicStrategy; +use rustc_ast::ast; use rustc_attr as attr; use rustc_span::symbol::Symbol; use rustc_span::{Span, DUMMY_SP}; @@ -56,7 +57,6 @@ use std::borrow::Cow; use std::convert::TryFrom; use std::ops::Deref; use std::sync::Arc; -use syntax::ast; #[macro_use] mod plumbing; diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index f96bf6c110cec..109ac97fe6265 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -7,6 +7,7 @@ use crate::session::{CrateDisambiguator, Session}; use crate::ty::codec::{self as ty_codec, TyDecoder, TyEncoder}; use crate::ty::context::TyCtxt; use crate::ty::{self, Ty}; +use rustc_ast::ast::Ident; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::{HashMapExt, Lock, Lrc, Once}; use rustc_data_structures::thin_vec::ThinVec; @@ -22,7 +23,6 @@ use rustc_span::hygiene::{ExpnId, SyntaxContext}; use rustc_span::source_map::{SourceMap, StableSourceFileId}; use rustc_span::{BytePos, SourceFile, Span, DUMMY_SP}; use std::mem; -use syntax::ast::Ident; const TAG_FILE_FOOTER: u128 = 0xC0FFEE_C0FFEE_C0FFEE_C0FFEE_C0FFEE; diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index 03ff1b8a3171f..e2fa03139110c 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -260,8 +260,8 @@ CloneTypeFoldableAndLiftImpls! { u64, String, crate::middle::region::Scope, - ::syntax::ast::FloatTy, - ::syntax::ast::NodeId, + ::rustc_ast::ast::FloatTy, + ::rustc_ast::ast::NodeId, ::rustc_span::symbol::Symbol, ::rustc_hir::def::Res, ::rustc_hir::def_id::DefId, diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 283333b6a3db2..fcf23b9023b28 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -17,6 +17,7 @@ use crate::ty::{ }; use crate::ty::{List, ParamEnv, ParamEnvAnd, TyS}; use polonius_engine::Atom; +use rustc_ast::ast::{self, Ident}; use rustc_data_structures::captures::Captures; use rustc_hir as hir; use rustc_hir::def_id::DefId; @@ -29,7 +30,6 @@ use std::borrow::Cow; use std::cmp::Ordering; use std::marker::PhantomData; use std::ops::Range; -use syntax::ast::{self, Ident}; #[derive( Clone, @@ -118,7 +118,7 @@ impl BoundRegion { } /// N.B., if you change this, you'll probably want to change the corresponding -/// AST structure in `libsyntax/ast.rs` as well. +/// AST structure in `librustc_ast/ast.rs` as well. #[derive( Clone, PartialEq, diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index eec6893d357d6..7b1f821877baa 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -10,6 +10,7 @@ use crate::ty::TyKind::*; use crate::ty::{self, DefIdTree, GenericParamDefKind, Ty, TyCtxt, TypeFoldable}; use crate::util::common::ErrorReported; use rustc_apfloat::Float as _; +use rustc_ast::ast; use rustc_attr::{self as attr, SignedInt, UnsignedInt}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; @@ -21,7 +22,6 @@ use rustc_span::Span; use rustc_target::abi::TargetDataLayout; use smallvec::SmallVec; use std::{cmp, fmt}; -use syntax::ast; #[derive(Copy, Clone, Debug)] pub struct Discr<'tcx> { diff --git a/src/libsyntax/Cargo.toml b/src/librustc_ast/Cargo.toml similarity index 93% rename from src/libsyntax/Cargo.toml rename to src/librustc_ast/Cargo.toml index ff03ae3f425c4..867bcf7923264 100644 --- a/src/libsyntax/Cargo.toml +++ b/src/librustc_ast/Cargo.toml @@ -1,11 +1,11 @@ [package] authors = ["The Rust Project Developers"] -name = "syntax" +name = "rustc_ast" version = "0.0.0" edition = "2018" [lib] -name = "syntax" +name = "rustc_ast" path = "lib.rs" doctest = false diff --git a/src/libsyntax/README.md b/src/librustc_ast/README.md similarity index 100% rename from src/libsyntax/README.md rename to src/librustc_ast/README.md diff --git a/src/libsyntax/ast.rs b/src/librustc_ast/ast.rs similarity index 100% rename from src/libsyntax/ast.rs rename to src/librustc_ast/ast.rs diff --git a/src/libsyntax/ast/tests.rs b/src/librustc_ast/ast/tests.rs similarity index 100% rename from src/libsyntax/ast/tests.rs rename to src/librustc_ast/ast/tests.rs diff --git a/src/libsyntax/attr/mod.rs b/src/librustc_ast/attr/mod.rs similarity index 100% rename from src/libsyntax/attr/mod.rs rename to src/librustc_ast/attr/mod.rs diff --git a/src/libsyntax/build.rs b/src/librustc_ast/build.rs similarity index 100% rename from src/libsyntax/build.rs rename to src/librustc_ast/build.rs diff --git a/src/libsyntax/entry.rs b/src/librustc_ast/entry.rs similarity index 100% rename from src/libsyntax/entry.rs rename to src/librustc_ast/entry.rs diff --git a/src/libsyntax/expand/allocator.rs b/src/librustc_ast/expand/allocator.rs similarity index 100% rename from src/libsyntax/expand/allocator.rs rename to src/librustc_ast/expand/allocator.rs diff --git a/src/libsyntax/expand/mod.rs b/src/librustc_ast/expand/mod.rs similarity index 100% rename from src/libsyntax/expand/mod.rs rename to src/librustc_ast/expand/mod.rs diff --git a/src/libsyntax/lib.rs b/src/librustc_ast/lib.rs similarity index 100% rename from src/libsyntax/lib.rs rename to src/librustc_ast/lib.rs diff --git a/src/libsyntax/mut_visit.rs b/src/librustc_ast/mut_visit.rs similarity index 100% rename from src/libsyntax/mut_visit.rs rename to src/librustc_ast/mut_visit.rs diff --git a/src/libsyntax/node_id.rs b/src/librustc_ast/node_id.rs similarity index 100% rename from src/libsyntax/node_id.rs rename to src/librustc_ast/node_id.rs diff --git a/src/libsyntax/ptr.rs b/src/librustc_ast/ptr.rs similarity index 100% rename from src/libsyntax/ptr.rs rename to src/librustc_ast/ptr.rs diff --git a/src/libsyntax/token.rs b/src/librustc_ast/token.rs similarity index 100% rename from src/libsyntax/token.rs rename to src/librustc_ast/token.rs diff --git a/src/libsyntax/tokenstream.rs b/src/librustc_ast/tokenstream.rs similarity index 100% rename from src/libsyntax/tokenstream.rs rename to src/librustc_ast/tokenstream.rs diff --git a/src/libsyntax/util/classify.rs b/src/librustc_ast/util/classify.rs similarity index 100% rename from src/libsyntax/util/classify.rs rename to src/librustc_ast/util/classify.rs diff --git a/src/libsyntax/util/comments.rs b/src/librustc_ast/util/comments.rs similarity index 100% rename from src/libsyntax/util/comments.rs rename to src/librustc_ast/util/comments.rs diff --git a/src/libsyntax/util/comments/tests.rs b/src/librustc_ast/util/comments/tests.rs similarity index 100% rename from src/libsyntax/util/comments/tests.rs rename to src/librustc_ast/util/comments/tests.rs diff --git a/src/libsyntax/util/lev_distance.rs b/src/librustc_ast/util/lev_distance.rs similarity index 100% rename from src/libsyntax/util/lev_distance.rs rename to src/librustc_ast/util/lev_distance.rs diff --git a/src/libsyntax/util/lev_distance/tests.rs b/src/librustc_ast/util/lev_distance/tests.rs similarity index 100% rename from src/libsyntax/util/lev_distance/tests.rs rename to src/librustc_ast/util/lev_distance/tests.rs diff --git a/src/libsyntax/util/literal.rs b/src/librustc_ast/util/literal.rs similarity index 100% rename from src/libsyntax/util/literal.rs rename to src/librustc_ast/util/literal.rs diff --git a/src/libsyntax/util/map_in_place.rs b/src/librustc_ast/util/map_in_place.rs similarity index 100% rename from src/libsyntax/util/map_in_place.rs rename to src/librustc_ast/util/map_in_place.rs diff --git a/src/libsyntax/util/parser.rs b/src/librustc_ast/util/parser.rs similarity index 100% rename from src/libsyntax/util/parser.rs rename to src/librustc_ast/util/parser.rs diff --git a/src/libsyntax/visit.rs b/src/librustc_ast/visit.rs similarity index 100% rename from src/libsyntax/visit.rs rename to src/librustc_ast/visit.rs diff --git a/src/librustc_ast_lowering/Cargo.toml b/src/librustc_ast_lowering/Cargo.toml index f6ab60e199f33..23dc80facae1d 100644 --- a/src/librustc_ast_lowering/Cargo.toml +++ b/src/librustc_ast_lowering/Cargo.toml @@ -20,5 +20,5 @@ rustc_index = { path = "../librustc_index" } rustc_span = { path = "../librustc_span" } rustc_errors = { path = "../librustc_errors" } rustc_session = { path = "../librustc_session" } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } diff --git a/src/librustc_ast_lowering/expr.rs b/src/librustc_ast_lowering/expr.rs index d781fbde59cb7..6708ffabaf93e 100644 --- a/src/librustc_ast_lowering/expr.rs +++ b/src/librustc_ast_lowering/expr.rs @@ -1,15 +1,15 @@ use super::{ImplTraitContext, LoweringContext, ParamMode, ParenthesizedGenericArgs}; use rustc::bug; +use rustc_ast::ast::*; +use rustc_ast::attr; +use rustc_ast::ptr::P as AstP; use rustc_data_structures::thin_vec::ThinVec; use rustc_errors::struct_span_err; use rustc_hir as hir; use rustc_hir::def::Res; use rustc_span::source_map::{respan, DesugaringKind, Span, Spanned}; use rustc_span::symbol::{sym, Symbol}; -use syntax::ast::*; -use syntax::attr; -use syntax::ptr::P as AstP; impl<'hir> LoweringContext<'_, 'hir> { fn lower_exprs(&mut self, exprs: &[AstP]) -> &'hir [hir::Expr<'hir>] { @@ -783,7 +783,7 @@ impl<'hir> LoweringContext<'_, 'hir> { e2: Option<&Expr>, lims: RangeLimits, ) -> hir::ExprKind<'hir> { - use syntax::ast::RangeLimits::*; + use rustc_ast::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 b5e4fe90d0dce..13148d97a67f3 100644 --- a/src/librustc_ast_lowering/item.rs +++ b/src/librustc_ast_lowering/item.rs @@ -3,6 +3,10 @@ use super::{ImplTraitContext, ImplTraitPosition, ImplTraitTypeIdVisitor}; use rustc::arena::Arena; use rustc::bug; +use rustc_ast::ast::*; +use rustc_ast::attr; +use rustc_ast::node_id::NodeMap; +use rustc_ast::visit::{self, AssocCtxt, Visitor}; use rustc_errors::struct_span_err; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; @@ -11,10 +15,6 @@ use rustc_span::source_map::{respan, DesugaringKind}; use rustc_span::symbol::{kw, sym}; use rustc_span::Span; use rustc_target::spec::abi; -use syntax::ast::*; -use syntax::attr; -use syntax::node_id::NodeMap; -use syntax::visit::{self, AssocCtxt, Visitor}; use log::debug; use smallvec::{smallvec, SmallVec}; diff --git a/src/librustc_ast_lowering/lib.rs b/src/librustc_ast_lowering/lib.rs index 8bf9311bfc798..0f7ed9f72f8f6 100644 --- a/src/librustc_ast_lowering/lib.rs +++ b/src/librustc_ast_lowering/lib.rs @@ -39,6 +39,14 @@ use rustc::dep_graph::DepGraph; use rustc::hir::map::definitions::{DefKey, DefPathData, Definitions}; use rustc::hir::map::Map; use rustc::{bug, span_bug}; +use rustc_ast::ast; +use rustc_ast::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_pretty::pprust; use rustc_data_structures::captures::Captures; use rustc_data_structures::fx::FxHashSet; @@ -58,14 +66,6 @@ use rustc_span::hygiene::ExpnId; use rustc_span::source_map::{respan, DesugaringKind, ExpnData, ExpnKind}; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::Span; -use syntax::ast; -use syntax::ast::*; -use syntax::attr; -use syntax::node_id::NodeMap; -use syntax::token::{self, Nonterminal, Token}; -use syntax::tokenstream::{TokenStream, TokenTree}; -use syntax::visit::{self, AssocCtxt, Visitor}; -use syntax::walk_list; use log::{debug, trace}; use smallvec::{smallvec, SmallVec}; diff --git a/src/librustc_ast_lowering/pat.rs b/src/librustc_ast_lowering/pat.rs index b42b12c4dd851..d6f4ba1529be6 100644 --- a/src/librustc_ast_lowering/pat.rs +++ b/src/librustc_ast_lowering/pat.rs @@ -1,10 +1,10 @@ use super::{ImplTraitContext, LoweringContext, ParamMode}; +use rustc_ast::ast::*; +use rustc_ast::ptr::P; use rustc_hir as hir; use rustc_hir::def::Res; use rustc_span::{source_map::Spanned, Span}; -use syntax::ast::*; -use syntax::ptr::P; impl<'a, 'hir> LoweringContext<'a, 'hir> { crate fn lower_pat(&mut self, p: &Pat) -> &'hir hir::Pat<'hir> { diff --git a/src/librustc_ast_lowering/path.rs b/src/librustc_ast_lowering/path.rs index 248874dbe46f5..80d7e3d0d465a 100644 --- a/src/librustc_ast_lowering/path.rs +++ b/src/librustc_ast_lowering/path.rs @@ -3,6 +3,7 @@ use super::{GenericArgsCtor, ParenthesizedGenericArgs}; use rustc::lint::builtin::ELIDED_LIFETIMES_IN_PATHS; use rustc::span_bug; +use rustc_ast::ast::{self, *}; use rustc_errors::{struct_span_err, Applicability}; use rustc_hir as hir; use rustc_hir::def::{DefKind, PartialRes, Res}; @@ -10,7 +11,6 @@ use rustc_hir::def_id::DefId; use rustc_hir::GenericArg; use rustc_session::lint::BuiltinLintDiagnostics; use rustc_span::Span; -use syntax::ast::{self, *}; use log::debug; use smallvec::smallvec; diff --git a/src/librustc_ast_passes/Cargo.toml b/src/librustc_ast_passes/Cargo.toml index 01d2ac449b590..5d096e4965ddc 100644 --- a/src/librustc_ast_passes/Cargo.toml +++ b/src/librustc_ast_passes/Cargo.toml @@ -18,4 +18,4 @@ rustc_feature = { path = "../librustc_feature" } rustc_parse = { path = "../librustc_parse" } rustc_session = { path = "../librustc_session" } rustc_span = { path = "../librustc_span" } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } diff --git a/src/librustc_ast_passes/ast_validation.rs b/src/librustc_ast_passes/ast_validation.rs index 0463ad7fb7b6f..9f04c01bfa8f4 100644 --- a/src/librustc_ast_passes/ast_validation.rs +++ b/src/librustc_ast_passes/ast_validation.rs @@ -6,6 +6,11 @@ // 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::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor}; +use rustc_ast::walk_list; use rustc_ast_pretty::pprust; use rustc_data_structures::fx::FxHashMap; use rustc_errors::{error_code, struct_span_err, Applicability}; @@ -16,11 +21,6 @@ use rustc_session::Session; use rustc_span::symbol::{kw, sym}; use rustc_span::Span; use std::mem; -use syntax::ast::*; -use syntax::attr; -use syntax::expand::is_proc_macro_attr; -use syntax::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor}; -use syntax::walk_list; const MORE_EXTERN: &str = "for more information, visit https://doc.rust-lang.org/std/keyword.extern.html"; diff --git a/src/librustc_ast_passes/feature_gate.rs b/src/librustc_ast_passes/feature_gate.rs index 33ff0bc451b32..05e69d0cfd74e 100644 --- a/src/librustc_ast_passes/feature_gate.rs +++ b/src/librustc_ast_passes/feature_gate.rs @@ -1,3 +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_errors::{struct_span_err, Handler}; use rustc_feature::{AttributeGate, BUILTIN_ATTRIBUTE_MAP}; use rustc_feature::{Features, GateIssue, UnstableFeatures}; @@ -5,10 +9,6 @@ use rustc_session::parse::{feature_err, feature_err_issue, ParseSess}; use rustc_span::source_map::Spanned; use rustc_span::symbol::sym; use rustc_span::Span; -use syntax::ast::{self, AssocTyConstraint, AssocTyConstraintKind, NodeId}; -use syntax::ast::{GenericParam, GenericParamKind, PatKind, RangeEnd, VariantData}; -use syntax::attr; -use syntax::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor}; use log::debug; diff --git a/src/librustc_ast_passes/node_count.rs b/src/librustc_ast_passes/node_count.rs index ed1ccdf6a768a..16bcec8360e34 100644 --- a/src/librustc_ast_passes/node_count.rs +++ b/src/librustc_ast_passes/node_count.rs @@ -1,8 +1,8 @@ // Simply gives a rought count of the number of nodes in an AST. +use rustc_ast::ast::*; +use rustc_ast::visit::*; use rustc_span::Span; -use syntax::ast::*; -use syntax::visit::*; pub struct NodeCounter { pub count: usize, diff --git a/src/librustc_ast_passes/show_span.rs b/src/librustc_ast_passes/show_span.rs index 4596e8ff53dde..73a66ba566bc6 100644 --- a/src/librustc_ast_passes/show_span.rs +++ b/src/librustc_ast_passes/show_span.rs @@ -5,9 +5,9 @@ use std::str::FromStr; -use syntax::ast; -use syntax::visit; -use syntax::visit::Visitor; +use rustc_ast::ast; +use rustc_ast::visit; +use rustc_ast::visit::Visitor; enum Mode { Expression, diff --git a/src/librustc_ast_pretty/Cargo.toml b/src/librustc_ast_pretty/Cargo.toml index 2f7f804b62887..82be095db8805 100644 --- a/src/librustc_ast_pretty/Cargo.toml +++ b/src/librustc_ast_pretty/Cargo.toml @@ -13,4 +13,4 @@ doctest = false log = "0.4" rustc_span = { path = "../librustc_span" } rustc_data_structures = { path = "../librustc_data_structures" } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } diff --git a/src/librustc_ast_pretty/pprust.rs b/src/librustc_ast_pretty/pprust.rs index 76e1e7c175b01..ea8535eabef3f 100644 --- a/src/librustc_ast_pretty/pprust.rs +++ b/src/librustc_ast_pretty/pprust.rs @@ -1,19 +1,19 @@ 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_span::edition::Edition; use rustc_span::source_map::{SourceMap, Spanned}; use rustc_span::symbol::{kw, sym, IdentPrinter}; use rustc_span::{BytePos, FileName, Span}; -use syntax::ast::{self, BlockCheckMode, PatKind, RangeEnd, RangeSyntax}; -use syntax::ast::{Attribute, GenericArg, MacArgs}; -use syntax::ast::{GenericBound, SelfKind, TraitBoundModifier}; -use syntax::attr; -use syntax::ptr::P; -use syntax::token::{self, BinOpToken, DelimToken, Nonterminal, Token, TokenKind}; -use syntax::tokenstream::{self, TokenStream, TokenTree}; -use syntax::util::parser::{self, AssocOp, Fixity}; -use syntax::util::{classify, comments}; use std::borrow::Cow; diff --git a/src/librustc_ast_pretty/pprust/tests.rs b/src/librustc_ast_pretty/pprust/tests.rs index 4531c7392a9d5..455f2e3da3680 100644 --- a/src/librustc_ast_pretty/pprust/tests.rs +++ b/src/librustc_ast_pretty/pprust/tests.rs @@ -1,9 +1,9 @@ use super::*; +use rustc_ast::ast; +use rustc_ast::with_default_globals; use rustc_span; use rustc_span::source_map::respan; -use syntax::ast; -use syntax::with_default_globals; fn fun_to_string( decl: &ast::FnDecl, diff --git a/src/librustc_attr/Cargo.toml b/src/librustc_attr/Cargo.toml index 83a5f41989b6c..8aaba15d84ad2 100644 --- a/src/librustc_attr/Cargo.toml +++ b/src/librustc_attr/Cargo.toml @@ -19,4 +19,4 @@ rustc_feature = { path = "../librustc_feature" } rustc_macros = { path = "../librustc_macros" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } rustc_session = { path = "../librustc_session" } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } diff --git a/src/librustc_attr/builtin.rs b/src/librustc_attr/builtin.rs index e8deee5b1f322..08eae24da9b68 100644 --- a/src/librustc_attr/builtin.rs +++ b/src/librustc_attr/builtin.rs @@ -2,6 +2,7 @@ use super::{find_by_name, mark_used}; +use rustc_ast::ast::{self, 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}; @@ -10,7 +11,6 @@ use rustc_session::parse::{feature_err, ParseSess}; use rustc_span::hygiene::Transparency; use rustc_span::{symbol::sym, symbol::Symbol, Span}; use std::num::NonZeroU32; -use syntax::ast::{self, Attribute, MetaItem, MetaItemKind, NestedMetaItem}; pub fn is_builtin_attr(attr: &Attribute) -> bool { attr.is_doc_comment() || attr.ident().filter(|ident| is_builtin_attr_name(ident.name)).is_some() diff --git a/src/librustc_attr/lib.rs b/src/librustc_attr/lib.rs index d2ff167db88e5..9803501fb96c2 100644 --- a/src/librustc_attr/lib.rs +++ b/src/librustc_attr/lib.rs @@ -1,6 +1,6 @@ //! Functions and types dealing with attributes and meta items. //! -//! FIXME(Centril): For now being, much of the logic is still in `syntax::attr`. +//! FIXME(Centril): For now being, much of the logic is still in `rustc_ast::attr`. //! The goal is to move the definition of `MetaItem` and things that don't need to be in `syntax` //! to this crate. @@ -11,6 +11,6 @@ pub use IntType::*; pub use ReprAttr::*; pub use StabilityLevel::*; -pub use syntax::attr::*; +pub use rustc_ast::attr::*; -pub(crate) use syntax::HashStableContext; +pub(crate) use rustc_ast::HashStableContext; diff --git a/src/librustc_builtin_macros/Cargo.toml b/src/librustc_builtin_macros/Cargo.toml index b424ce432148f..c15438bde440e 100644 --- a/src/librustc_builtin_macros/Cargo.toml +++ b/src/librustc_builtin_macros/Cargo.toml @@ -21,6 +21,6 @@ rustc_parse = { path = "../librustc_parse" } rustc_target = { path = "../librustc_target" } rustc_session = { path = "../librustc_session" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } rustc_expand = { path = "../librustc_expand" } rustc_span = { path = "../librustc_span" } diff --git a/src/librustc_builtin_macros/asm.rs b/src/librustc_builtin_macros/asm.rs index 9f98cf253c977..d9d990199637e 100644 --- a/src/librustc_builtin_macros/asm.rs +++ b/src/librustc_builtin_macros/asm.rs @@ -2,15 +2,15 @@ // use State::*; +use rustc_ast::ast::{self, AsmDialect}; +use rustc_ast::ptr::P; +use rustc_ast::token::{self, Token}; +use rustc_ast::tokenstream::{self, TokenStream}; use rustc_errors::{struct_span_err, DiagnosticBuilder, PResult}; use rustc_expand::base::*; use rustc_parse::parser::Parser; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::Span; -use syntax::ast::{self, AsmDialect}; -use syntax::ptr::P; -use syntax::token::{self, Token}; -use syntax::tokenstream::{self, TokenStream}; enum State { Asm, diff --git a/src/librustc_builtin_macros/assert.rs b/src/librustc_builtin_macros/assert.rs index 3fc86a5469c2f..c58f004b3f2a0 100644 --- a/src/librustc_builtin_macros/assert.rs +++ b/src/librustc_builtin_macros/assert.rs @@ -1,14 +1,14 @@ 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_pretty::pprust; use rustc_expand::base::*; use rustc_parse::parser::Parser; use rustc_span::symbol::{sym, Symbol}; use rustc_span::{Span, DUMMY_SP}; -use syntax::ast::{self, *}; -use syntax::ptr::P; -use syntax::token::{self, TokenKind}; -use syntax::tokenstream::{DelimSpan, TokenStream, TokenTree}; pub fn expand_assert<'cx>( cx: &'cx mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/cfg.rs b/src/librustc_builtin_macros/cfg.rs index c9a77ee0acd15..3c09b26af42f2 100644 --- a/src/librustc_builtin_macros/cfg.rs +++ b/src/librustc_builtin_macros/cfg.rs @@ -2,13 +2,13 @@ //! a literal `true` or `false` based on whether the given cfg matches the //! current compilation environment. +use rustc_ast::ast; +use rustc_ast::token; +use rustc_ast::tokenstream::TokenStream; use rustc_attr as attr; use rustc_errors::DiagnosticBuilder; use rustc_expand::base::{self, *}; use rustc_span::Span; -use syntax::ast; -use syntax::token; -use syntax::tokenstream::TokenStream; pub fn expand_cfg( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/cmdline_attrs.rs b/src/librustc_builtin_macros/cmdline_attrs.rs index aa373d31e0609..7ddbf08306b72 100644 --- a/src/librustc_builtin_macros/cmdline_attrs.rs +++ b/src/librustc_builtin_macros/cmdline_attrs.rs @@ -1,11 +1,11 @@ //! 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_expand::panictry; use rustc_session::parse::ParseSess; use rustc_span::FileName; -use syntax::ast::{self, AttrItem, AttrStyle}; -use syntax::attr::mk_attr; -use syntax::token; pub fn inject(mut krate: ast::Crate, parse_sess: &ParseSess, attrs: &[String]) -> ast::Crate { for raw_attr in attrs { diff --git a/src/librustc_builtin_macros/compile_error.rs b/src/librustc_builtin_macros/compile_error.rs index 4d8d168a2a866..f5955604e5fb2 100644 --- a/src/librustc_builtin_macros/compile_error.rs +++ b/src/librustc_builtin_macros/compile_error.rs @@ -1,8 +1,8 @@ // The compiler code necessary to support the compile_error! extension. +use rustc_ast::tokenstream::TokenStream; use rustc_expand::base::{self, *}; use rustc_span::Span; -use syntax::tokenstream::TokenStream; pub fn expand_compile_error<'cx>( cx: &'cx mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/concat.rs b/src/librustc_builtin_macros/concat.rs index 1f1c8b8d21e39..e0ce37b95fcd6 100644 --- a/src/librustc_builtin_macros/concat.rs +++ b/src/librustc_builtin_macros/concat.rs @@ -1,7 +1,7 @@ +use rustc_ast::ast; +use rustc_ast::tokenstream::TokenStream; use rustc_expand::base::{self, DummyResult}; use rustc_span::symbol::Symbol; -use syntax::ast; -use syntax::tokenstream::TokenStream; use std::string::String; diff --git a/src/librustc_builtin_macros/concat_idents.rs b/src/librustc_builtin_macros/concat_idents.rs index 449cb2a0b1887..b55e71b2518f4 100644 --- a/src/librustc_builtin_macros/concat_idents.rs +++ b/src/librustc_builtin_macros/concat_idents.rs @@ -1,10 +1,10 @@ +use rustc_ast::ast; +use rustc_ast::ptr::P; +use rustc_ast::token::{self, Token}; +use rustc_ast::tokenstream::{TokenStream, TokenTree}; use rustc_expand::base::{self, *}; use rustc_span::symbol::Symbol; use rustc_span::Span; -use syntax::ast; -use syntax::ptr::P; -use syntax::token::{self, Token}; -use syntax::tokenstream::{TokenStream, TokenTree}; pub fn expand_concat_idents<'cx>( cx: &'cx mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/bounds.rs b/src/librustc_builtin_macros/deriving/bounds.rs index ceb9aab484864..a1c818caff3bf 100644 --- a/src/librustc_builtin_macros/deriving/bounds.rs +++ b/src/librustc_builtin_macros/deriving/bounds.rs @@ -2,9 +2,9 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::path_std; +use rustc_ast::ast::MetaItem; use rustc_expand::base::{Annotatable, ExtCtxt}; use rustc_span::Span; -use syntax::ast::MetaItem; pub fn expand_deriving_copy( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/clone.rs b/src/librustc_builtin_macros/deriving/clone.rs index 0df5ef3c9d882..97569ef813886 100644 --- a/src/librustc_builtin_macros/deriving/clone.rs +++ b/src/librustc_builtin_macros/deriving/clone.rs @@ -2,11 +2,11 @@ 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_expand::base::{Annotatable, ExtCtxt}; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::Span; -use syntax::ast::{self, Expr, GenericArg, Generics, ItemKind, MetaItem, VariantData}; -use syntax::ptr::P; pub fn expand_deriving_clone( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/cmp/eq.rs b/src/librustc_builtin_macros/deriving/cmp/eq.rs index cb8933c14756f..b39f41513ee35 100644 --- a/src/librustc_builtin_macros/deriving/cmp/eq.rs +++ b/src/librustc_builtin_macros/deriving/cmp/eq.rs @@ -2,11 +2,11 @@ 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_expand::base::{Annotatable, ExtCtxt}; use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; -use syntax::ast::{self, Expr, GenericArg, Ident, MetaItem}; -use syntax::ptr::P; pub fn expand_deriving_eq( cx: &mut ExtCtxt<'_>, @@ -16,8 +16,8 @@ pub fn expand_deriving_eq( push: &mut dyn FnMut(Annotatable), ) { let inline = cx.meta_word(span, sym::inline); - let hidden = syntax::attr::mk_nested_word_item(Ident::new(sym::hidden, span)); - let doc = syntax::attr::mk_list_item(Ident::new(sym::doc, span), vec![hidden]); + let hidden = rustc_ast::attr::mk_nested_word_item(Ident::new(sym::hidden, span)); + let doc = rustc_ast::attr::mk_list_item(Ident::new(sym::doc, span), vec![hidden]); let attrs = vec![cx.attribute(inline), cx.attribute(doc)]; let trait_def = TraitDef { span, diff --git a/src/librustc_builtin_macros/deriving/cmp/ord.rs b/src/librustc_builtin_macros/deriving/cmp/ord.rs index fa43098380671..b23fbc6f62bdb 100644 --- a/src/librustc_builtin_macros/deriving/cmp/ord.rs +++ b/src/librustc_builtin_macros/deriving/cmp/ord.rs @@ -2,11 +2,11 @@ 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_expand::base::{Annotatable, ExtCtxt}; use rustc_span::symbol::sym; use rustc_span::Span; -use syntax::ast::{self, Expr, MetaItem}; -use syntax::ptr::P; pub fn expand_deriving_ord( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/cmp/partial_eq.rs b/src/librustc_builtin_macros/deriving/cmp/partial_eq.rs index dc2912895a8e1..d3f1a9c15f49e 100644 --- a/src/librustc_builtin_macros/deriving/cmp/partial_eq.rs +++ b/src/librustc_builtin_macros/deriving/cmp/partial_eq.rs @@ -2,11 +2,11 @@ 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_expand::base::{Annotatable, ExtCtxt}; use rustc_span::symbol::sym; use rustc_span::Span; -use syntax::ast::{BinOpKind, Expr, MetaItem}; -use syntax::ptr::P; pub fn expand_deriving_partial_eq( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/cmp/partial_ord.rs b/src/librustc_builtin_macros/deriving/cmp/partial_ord.rs index a54d8c56f758d..835ccd1b022e1 100644 --- a/src/librustc_builtin_macros/deriving/cmp/partial_ord.rs +++ b/src/librustc_builtin_macros/deriving/cmp/partial_ord.rs @@ -4,11 +4,11 @@ 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_expand::base::{Annotatable, ExtCtxt}; use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; -use syntax::ast::{self, BinOpKind, Expr, MetaItem}; -use syntax::ptr::P; pub fn expand_deriving_partial_ord( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/debug.rs b/src/librustc_builtin_macros/deriving/debug.rs index f68fddee71be5..f47be3c3c1975 100644 --- a/src/librustc_builtin_macros/deriving/debug.rs +++ b/src/librustc_builtin_macros/deriving/debug.rs @@ -2,12 +2,12 @@ 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_expand::base::{Annotatable, ExtCtxt}; use rustc_span::symbol::sym; use rustc_span::{Span, DUMMY_SP}; -use syntax::ast::{self, Ident}; -use syntax::ast::{Expr, MetaItem}; -use syntax::ptr::P; pub fn expand_deriving_debug( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/decodable.rs b/src/librustc_builtin_macros/deriving/decodable.rs index 3b20ebbbab45b..ac5d08ba62d0d 100644 --- a/src/librustc_builtin_macros/deriving/decodable.rs +++ b/src/librustc_builtin_macros/deriving/decodable.rs @@ -4,12 +4,12 @@ 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_expand::base::{Annotatable, ExtCtxt}; use rustc_span::symbol::Symbol; use rustc_span::Span; -use syntax::ast; -use syntax::ast::{Expr, MetaItem, Mutability}; -use syntax::ptr::P; pub fn expand_deriving_rustc_decodable( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/default.rs b/src/librustc_builtin_macros/deriving/default.rs index b4f059e94c15e..cb85a0b1a10cc 100644 --- a/src/librustc_builtin_macros/deriving/default.rs +++ b/src/librustc_builtin_macros/deriving/default.rs @@ -2,12 +2,12 @@ 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_errors::struct_span_err; use rustc_expand::base::{Annotatable, DummyResult, ExtCtxt}; use rustc_span::symbol::{kw, sym}; use rustc_span::Span; -use syntax::ast::{Expr, MetaItem}; -use syntax::ptr::P; pub fn expand_deriving_default( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/encodable.rs b/src/librustc_builtin_macros/deriving/encodable.rs index b330f00939fca..9073085381ac1 100644 --- a/src/librustc_builtin_macros/deriving/encodable.rs +++ b/src/librustc_builtin_macros/deriving/encodable.rs @@ -89,11 +89,11 @@ 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_expand::base::{Annotatable, ExtCtxt}; use rustc_span::symbol::Symbol; use rustc_span::Span; -use syntax::ast::{Expr, ExprKind, MetaItem, Mutability}; -use syntax::ptr::P; pub fn expand_deriving_rustc_encodable( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/generic/mod.rs b/src/librustc_builtin_macros/deriving/generic/mod.rs index 7f7ee6e0fed7b..311298c0f4083 100644 --- a/src/librustc_builtin_macros/deriving/generic/mod.rs +++ b/src/librustc_builtin_macros/deriving/generic/mod.rs @@ -181,16 +181,16 @@ 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_attr as attr; use rustc_expand::base::{Annotatable, ExtCtxt}; use rustc_session::parse::ParseSess; use rustc_span::source_map::respan; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::Span; -use syntax::ast::{self, BinOpKind, EnumDef, Expr, Generics, Ident, PatKind}; -use syntax::ast::{GenericArg, GenericParamKind, VariantData}; -use syntax::ptr::P; -use syntax::util::map_in_place::MapInPlace; use ty::{LifetimeBounds, Path, Ptr, PtrTy, Self_, Ty}; @@ -339,7 +339,7 @@ fn find_type_parameters( ty_param_names: &[ast::Name], cx: &ExtCtxt<'_>, ) -> Vec> { - use syntax::visit; + use rustc_ast::visit; struct Visitor<'a, 'b> { cx: &'a ExtCtxt<'b>, @@ -689,11 +689,11 @@ impl<'a> TraitDef<'a> { attr::mark_used(&attr); let opt_trait_ref = Some(trait_ref); let unused_qual = { - let word = syntax::attr::mk_nested_word_item(Ident::new( + let word = rustc_ast::attr::mk_nested_word_item(Ident::new( Symbol::intern("unused_qualifications"), self.span, )); - let list = syntax::attr::mk_list_item(Ident::new(sym::allow, self.span), vec![word]); + let list = rustc_ast::attr::mk_list_item(Ident::new(sym::allow, self.span), vec![word]); cx.attribute(list) }; diff --git a/src/librustc_builtin_macros/deriving/generic/ty.rs b/src/librustc_builtin_macros/deriving/generic/ty.rs index d2df64cac4869..bd54a73531197 100644 --- a/src/librustc_builtin_macros/deriving/generic/ty.rs +++ b/src/librustc_builtin_macros/deriving/generic/ty.rs @@ -4,12 +4,12 @@ pub use PtrTy::*; pub use Ty::*; +use rustc_ast::ast::{self, Expr, GenericArg, GenericParamKind, Generics, Ident, SelfKind}; +use rustc_ast::ptr::P; use rustc_expand::base::ExtCtxt; use rustc_span::source_map::{respan, DUMMY_SP}; use rustc_span::symbol::kw; use rustc_span::Span; -use syntax::ast::{self, Expr, GenericArg, GenericParamKind, Generics, Ident, SelfKind}; -use syntax::ptr::P; /// The types of pointers #[derive(Clone)] diff --git a/src/librustc_builtin_macros/deriving/hash.rs b/src/librustc_builtin_macros/deriving/hash.rs index e620711aa2bd4..8776e7ef50790 100644 --- a/src/librustc_builtin_macros/deriving/hash.rs +++ b/src/librustc_builtin_macros/deriving/hash.rs @@ -2,11 +2,11 @@ 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_expand::base::{Annotatable, ExtCtxt}; use rustc_span::symbol::sym; use rustc_span::Span; -use syntax::ast::{Expr, MetaItem, Mutability}; -use syntax::ptr::P; pub fn expand_deriving_hash( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/mod.rs b/src/librustc_builtin_macros/deriving/mod.rs index 63cd03527e15c..5ba9d3800e118 100644 --- a/src/librustc_builtin_macros/deriving/mod.rs +++ b/src/librustc_builtin_macros/deriving/mod.rs @@ -1,10 +1,10 @@ //! The compiler code necessary to implement the `#[derive]` extensions. +use rustc_ast::ast::{self, ItemKind, MetaItem}; +use rustc_ast::ptr::P; use rustc_expand::base::{Annotatable, ExtCtxt, MultiItemModifier}; use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; -use syntax::ast::{self, ItemKind, MetaItem}; -use syntax::ptr::P; macro path_local($x:ident) { generic::ty::Path::new_local(stringify!($x)) diff --git a/src/librustc_builtin_macros/env.rs b/src/librustc_builtin_macros/env.rs index 896bb8ca05392..fba76f8b4962f 100644 --- a/src/librustc_builtin_macros/env.rs +++ b/src/librustc_builtin_macros/env.rs @@ -3,11 +3,11 @@ // interface. // +use rustc_ast::ast::{self, GenericArg, Ident}; +use rustc_ast::tokenstream::TokenStream; use rustc_expand::base::{self, *}; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::Span; -use syntax::ast::{self, GenericArg, Ident}; -use syntax::tokenstream::TokenStream; use std::env; diff --git a/src/librustc_builtin_macros/format.rs b/src/librustc_builtin_macros/format.rs index 0684662b2bfe1..da81347f59f5e 100644 --- a/src/librustc_builtin_macros/format.rs +++ b/src/librustc_builtin_macros/format.rs @@ -3,15 +3,15 @@ use Position::*; use fmt_macros as parse; +use rustc_ast::ast; +use rustc_ast::ptr::P; +use rustc_ast::token; +use rustc_ast::tokenstream::TokenStream; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::{pluralize, Applicability, DiagnosticBuilder}; use rustc_expand::base::{self, *}; use rustc_span::symbol::{sym, Symbol}; use rustc_span::{MultiSpan, Span}; -use syntax::ast; -use syntax::ptr::P; -use syntax::token; -use syntax::tokenstream::TokenStream; use std::borrow::Cow; use std::collections::hash_map::Entry; diff --git a/src/librustc_builtin_macros/global_allocator.rs b/src/librustc_builtin_macros/global_allocator.rs index 5a0b1a6b88542..8de7455a09a64 100644 --- a/src/librustc_builtin_macros/global_allocator.rs +++ b/src/librustc_builtin_macros/global_allocator.rs @@ -1,12 +1,14 @@ use crate::util::check_builtin_macro_attribute; +use rustc_ast::ast::{self, Attribute, Expr, FnHeader, FnSig, Generics, Ident, 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_expand::base::{Annotatable, ExtCtxt}; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::Span; -use syntax::ast::{self, Attribute, Expr, FnHeader, FnSig, Generics, Ident, Param}; -use syntax::ast::{ItemKind, Mutability, Stmt, Ty, TyKind, Unsafe}; -use syntax::expand::allocator::{AllocatorKind, AllocatorMethod, AllocatorTy, ALLOCATOR_METHODS}; -use syntax::ptr::P; pub fn expand( ecx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/global_asm.rs b/src/librustc_builtin_macros/global_asm.rs index 052e62ee9ffd3..307e7fe71212b 100644 --- a/src/librustc_builtin_macros/global_asm.rs +++ b/src/librustc_builtin_macros/global_asm.rs @@ -8,15 +8,15 @@ //! LLVM's `module asm "some assembly here"`. All of LLVM's caveats //! therefore apply. +use rustc_ast::ast; +use rustc_ast::ptr::P; +use rustc_ast::token; +use rustc_ast::tokenstream::TokenStream; use rustc_errors::DiagnosticBuilder; use rustc_expand::base::{self, *}; use rustc_span::source_map::respan; use rustc_span::Span; use smallvec::smallvec; -use syntax::ast; -use syntax::ptr::P; -use syntax::token; -use syntax::tokenstream::TokenStream; pub fn expand_global_asm<'cx>( cx: &'cx mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/lib.rs b/src/librustc_builtin_macros/lib.rs index c735ba0df3b31..9a8b0a87cb793 100644 --- a/src/librustc_builtin_macros/lib.rs +++ b/src/librustc_builtin_macros/lib.rs @@ -13,11 +13,11 @@ extern crate proc_macro; use crate::deriving::*; +use rustc_ast::ast::Ident; use rustc_expand::base::{MacroExpanderFn, Resolver, SyntaxExtension, SyntaxExtensionKind}; use rustc_expand::proc_macro::BangProcMacro; use rustc_span::edition::Edition; use rustc_span::symbol::sym; -use syntax::ast::Ident; mod asm; mod assert; diff --git a/src/librustc_builtin_macros/log_syntax.rs b/src/librustc_builtin_macros/log_syntax.rs index ac7ba49ba185d..ae3a889428ae4 100644 --- a/src/librustc_builtin_macros/log_syntax.rs +++ b/src/librustc_builtin_macros/log_syntax.rs @@ -1,6 +1,6 @@ +use rustc_ast::tokenstream::TokenStream; use rustc_ast_pretty::pprust; use rustc_expand::base; -use syntax::tokenstream::TokenStream; pub fn expand_log_syntax<'cx>( _cx: &'cx mut base::ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/proc_macro_harness.rs b/src/librustc_builtin_macros/proc_macro_harness.rs index b925cad9fdcdc..0a9b59f0e9adb 100644 --- a/src/librustc_builtin_macros/proc_macro_harness.rs +++ b/src/librustc_builtin_macros/proc_macro_harness.rs @@ -1,5 +1,10 @@ use std::mem; +use rustc_ast::ast::{self, Ident, NodeId}; +use rustc_ast::attr; +use rustc_ast::expand::is_proc_macro_attr; +use rustc_ast::ptr::P; +use rustc_ast::visit::{self, Visitor}; use rustc_ast_pretty::pprust; use rustc_expand::base::{ExtCtxt, Resolver}; use rustc_expand::expand::{AstFragment, ExpansionConfig}; @@ -9,11 +14,6 @@ use rustc_span::symbol::{kw, sym}; use rustc_span::{Span, DUMMY_SP}; use smallvec::smallvec; use std::cell::RefCell; -use syntax::ast::{self, Ident, NodeId}; -use syntax::attr; -use syntax::expand::is_proc_macro_attr; -use syntax::ptr::P; -use syntax::visit::{self, Visitor}; struct ProcMacroDerive { id: NodeId, diff --git a/src/librustc_builtin_macros/source_util.rs b/src/librustc_builtin_macros/source_util.rs index 264223bafbcf9..5ad72a7443dd2 100644 --- a/src/librustc_builtin_macros/source_util.rs +++ b/src/librustc_builtin_macros/source_util.rs @@ -1,3 +1,7 @@ +use rustc_ast::ast; +use rustc_ast::ptr::P; +use rustc_ast::token; +use rustc_ast::tokenstream::TokenStream; use rustc_ast_pretty::pprust; use rustc_expand::base::{self, *}; use rustc_expand::panictry; @@ -5,10 +9,6 @@ use rustc_parse::{self, new_sub_parser_from_file, parser::Parser, DirectoryOwner use rustc_session::lint::builtin::INCOMPLETE_INCLUDE; use rustc_span::symbol::Symbol; use rustc_span::{self, Pos, Span}; -use syntax::ast; -use syntax::ptr::P; -use syntax::token; -use syntax::tokenstream::TokenStream; use smallvec::SmallVec; diff --git a/src/librustc_builtin_macros/standard_library_imports.rs b/src/librustc_builtin_macros/standard_library_imports.rs index 6663eecbf5f4b..30403f6dc41c1 100644 --- a/src/librustc_builtin_macros/standard_library_imports.rs +++ b/src/librustc_builtin_macros/standard_library_imports.rs @@ -1,3 +1,5 @@ +use rustc_ast::ptr::P; +use rustc_ast::{ast, attr}; use rustc_expand::base::{ExtCtxt, Resolver}; use rustc_expand::expand::ExpansionConfig; use rustc_session::parse::ParseSess; @@ -5,8 +7,6 @@ use rustc_span::edition::Edition; use rustc_span::hygiene::AstPass; use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::DUMMY_SP; -use syntax::ptr::P; -use syntax::{ast, attr}; pub fn inject( mut krate: ast::Crate, diff --git a/src/librustc_builtin_macros/test.rs b/src/librustc_builtin_macros/test.rs index 8407352f57714..7fe65f28532d0 100644 --- a/src/librustc_builtin_macros/test.rs +++ b/src/librustc_builtin_macros/test.rs @@ -2,13 +2,13 @@ /// 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::attr; use rustc_ast_pretty::pprust; use rustc_expand::base::*; use rustc_span::source_map::respan; use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; -use syntax::ast; -use syntax::attr; use std::iter; diff --git a/src/librustc_builtin_macros/test_harness.rs b/src/librustc_builtin_macros/test_harness.rs index 4bbab0d257489..51a2170280559 100644 --- a/src/librustc_builtin_macros/test_harness.rs +++ b/src/librustc_builtin_macros/test_harness.rs @@ -1,6 +1,11 @@ // Code that generates a test runner to run all the tests in a crate use log::debug; +use rustc_ast::ast::{self, Ident}; +use rustc_ast::attr; +use rustc_ast::entry::{self, EntryPointType}; +use rustc_ast::mut_visit::{ExpectOne, *}; +use rustc_ast::ptr::P; use rustc_expand::base::{ExtCtxt, Resolver}; use rustc_expand::expand::{AstFragment, ExpansionConfig}; use rustc_feature::Features; @@ -11,11 +16,6 @@ use rustc_span::symbol::{sym, Symbol}; use rustc_span::{Span, DUMMY_SP}; use rustc_target::spec::PanicStrategy; use smallvec::{smallvec, SmallVec}; -use syntax::ast::{self, Ident}; -use syntax::attr; -use syntax::entry::{self, EntryPointType}; -use syntax::mut_visit::{ExpectOne, *}; -use syntax::ptr::P; use std::{iter, mem}; diff --git a/src/librustc_builtin_macros/trace_macros.rs b/src/librustc_builtin_macros/trace_macros.rs index c0b373f1370c1..c17f2afe4949e 100644 --- a/src/librustc_builtin_macros/trace_macros.rs +++ b/src/librustc_builtin_macros/trace_macros.rs @@ -1,7 +1,7 @@ +use rustc_ast::tokenstream::{TokenStream, TokenTree}; use rustc_expand::base::{self, ExtCtxt}; use rustc_span::symbol::kw; use rustc_span::Span; -use syntax::tokenstream::{TokenStream, TokenTree}; pub fn expand_trace_macros( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/util.rs b/src/librustc_builtin_macros/util.rs index b7d1a5d1d7c68..8ef76a8657e1e 100644 --- a/src/librustc_builtin_macros/util.rs +++ b/src/librustc_builtin_macros/util.rs @@ -1,8 +1,8 @@ +use rustc_ast::ast::MetaItem; use rustc_expand::base::ExtCtxt; use rustc_feature::AttributeTemplate; use rustc_parse::validate_attr; use rustc_span::Symbol; -use syntax::ast::MetaItem; pub fn check_builtin_macro_attribute(ecx: &ExtCtxt<'_>, meta_item: &MetaItem, name: Symbol) { // All the built-in macro attributes are "words" at the moment. diff --git a/src/librustc_codegen_llvm/Cargo.toml b/src/librustc_codegen_llvm/Cargo.toml index c5e862ffc179f..0776cb19760d5 100644 --- a/src/librustc_codegen_llvm/Cargo.toml +++ b/src/librustc_codegen_llvm/Cargo.toml @@ -33,5 +33,5 @@ rustc_session = { path = "../librustc_session" } rustc_serialize = { path = "../libserialize", package = "serialize" } rustc_target = { path = "../librustc_target" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } rustc_span = { path = "../librustc_span" } diff --git a/src/librustc_codegen_llvm/allocator.rs b/src/librustc_codegen_llvm/allocator.rs index 6dcf49f23fe9b..821377db0ee15 100644 --- a/src/librustc_codegen_llvm/allocator.rs +++ b/src/librustc_codegen_llvm/allocator.rs @@ -4,7 +4,7 @@ use crate::attributes; use libc::c_uint; use rustc::bug; use rustc::ty::TyCtxt; -use syntax::expand::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS}; +use rustc_ast::expand::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS}; use crate::llvm::{self, False, True}; use crate::ModuleLlvm; diff --git a/src/librustc_codegen_llvm/asm.rs b/src/librustc_codegen_llvm/asm.rs index e816bdeb1c92c..8066136c2fe42 100644 --- a/src/librustc_codegen_llvm/asm.rs +++ b/src/librustc_codegen_llvm/asm.rs @@ -134,7 +134,7 @@ fn inline_asm_call( output: &'ll llvm::Type, volatile: bool, alignstack: bool, - dia: ::syntax::ast::AsmDialect, + dia: ::rustc_ast::ast::AsmDialect, ) -> Option<&'ll Value> { let volatile = if volatile { llvm::True } else { llvm::False }; let alignstack = if alignstack { llvm::True } else { llvm::False }; diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs index ab6c55becdb02..32604d5601d30 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> { rhs: Self::Value, ) -> (Self::Value, Self::Value) { use rustc::ty::{Int, Uint}; - use syntax::ast::IntTy::*; - use syntax::ast::UintTy::*; + use rustc_ast::ast::IntTy::*; + use rustc_ast::ast::UintTy::*; let new_kind = match ty.kind { Int(t @ Isize) => Int(t.normalize(self.tcx.sess.target.ptr_width)), diff --git a/src/librustc_codegen_llvm/common.rs b/src/librustc_codegen_llvm/common.rs index 1d6bfb321598c..df38eeec00fce 100644 --- a/src/librustc_codegen_llvm/common.rs +++ b/src/librustc_codegen_llvm/common.rs @@ -18,8 +18,8 @@ use rustc_codegen_ssa::mir::place::PlaceRef; use libc::{c_char, c_uint}; +use rustc_ast::ast::Mutability; use rustc_span::symbol::Symbol; -use syntax::ast::Mutability; pub use crate::context::CodegenCx; diff --git a/src/librustc_codegen_llvm/debuginfo/gdb.rs b/src/librustc_codegen_llvm/debuginfo/gdb.rs index eae461a575f7f..753a4e18faf5e 100644 --- a/src/librustc_codegen_llvm/debuginfo/gdb.rs +++ b/src/librustc_codegen_llvm/debuginfo/gdb.rs @@ -9,8 +9,8 @@ use rustc::bug; use rustc::session::config::DebugInfo; use rustc_codegen_ssa::traits::*; +use rustc_ast::attr; use rustc_span::symbol::sym; -use syntax::attr; /// Inserts a side-effect free instruction sequence that makes sure that the /// .debug_gdb_scripts global is referenced, so it isn't removed by the linker. diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index d1f70ad43bd28..6ed3153963f98 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -32,6 +32,7 @@ use rustc::ty::subst::{GenericArgKind, SubstsRef}; use rustc::ty::Instance; use rustc::ty::{self, AdtKind, ParamEnv, Ty, TyCtxt}; use rustc::{bug, span_bug}; +use rustc_ast::ast; use rustc_codegen_ssa::traits::*; use rustc_data_structures::const_cstr; use rustc_data_structures::fingerprint::Fingerprint; @@ -45,7 +46,6 @@ use rustc_index::vec::{Idx, IndexVec}; use rustc_span::symbol::{Interner, Symbol}; use rustc_span::{self, FileName, Span}; use rustc_target::abi::HasDataLayout; -use syntax::ast; use libc::{c_longlong, c_uint}; use std::collections::hash_map::Entry; diff --git a/src/librustc_codegen_llvm/debuginfo/mod.rs b/src/librustc_codegen_llvm/debuginfo/mod.rs index 22effb102fd67..6515d5e3bec7f 100644 --- a/src/librustc_codegen_llvm/debuginfo/mod.rs +++ b/src/librustc_codegen_llvm/debuginfo/mod.rs @@ -35,11 +35,11 @@ use std::cell::RefCell; use std::ffi::CString; use rustc::ty::layout::{self, HasTyCtxt, LayoutOf, Size}; +use rustc_ast::ast; use rustc_codegen_ssa::traits::*; use rustc_span::symbol::Symbol; use rustc_span::{self, BytePos, Span}; use smallvec::SmallVec; -use syntax::ast; mod create_scope_map; pub mod gdb; diff --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs index 3d1e72e1c73d7..1ae9d2a684131 100644 --- a/src/librustc_codegen_llvm/intrinsic.rs +++ b/src/librustc_codegen_llvm/intrinsic.rs @@ -10,6 +10,7 @@ use crate::value::Value; use rustc::ty::layout::{self, FnAbiExt, HasTyCtxt, LayoutOf, Primitive}; use rustc::ty::{self, Ty}; use rustc::{bug, span_bug}; +use rustc_ast::ast; use rustc_codegen_ssa::base::{compare_simd_types, to_immediate, wants_msvc_seh}; use rustc_codegen_ssa::common::{IntPredicate, TypeKind}; use rustc_codegen_ssa::glue; @@ -18,7 +19,6 @@ use rustc_codegen_ssa::mir::place::PlaceRef; use rustc_codegen_ssa::MemFlags; use rustc_hir as hir; use rustc_target::abi::HasDataLayout; -use syntax::ast; use rustc_codegen_ssa::common::span_invalid_monomorphization_error; use rustc_codegen_ssa::traits::*; diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index b1085ba170330..f32657545745f 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -19,6 +19,7 @@ use rustc_span::symbol::Symbol; pub use llvm_util::target_features; use rustc::dep_graph::WorkProduct; +use rustc_ast::expand::allocator::AllocatorKind; use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule}; use rustc_codegen_ssa::back::write::{CodegenContext, FatLTOInput, ModuleConfig}; use rustc_codegen_ssa::traits::*; @@ -28,7 +29,6 @@ use std::any::Any; use std::ffi::CStr; use std::fs; use std::sync::Arc; -use syntax::expand::allocator::AllocatorKind; use rustc::dep_graph::DepGraph; use rustc::middle::cstore::{EncodedMetadata, MetadataLoaderDyn}; diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs index 808094eca91d5..f56647044e08b 100644 --- a/src/librustc_codegen_llvm/llvm/ffi.rs +++ b/src/librustc_codegen_llvm/llvm/ffi.rs @@ -381,10 +381,10 @@ pub enum AsmDialect { } impl AsmDialect { - pub fn from_generic(asm: syntax::ast::AsmDialect) -> Self { + pub fn from_generic(asm: rustc_ast::ast::AsmDialect) -> Self { match asm { - syntax::ast::AsmDialect::Att => AsmDialect::Att, - syntax::ast::AsmDialect::Intel => AsmDialect::Intel, + rustc_ast::ast::AsmDialect::Att => AsmDialect::Att, + rustc_ast::ast::AsmDialect::Intel => AsmDialect::Intel, } } } diff --git a/src/librustc_codegen_llvm/type_.rs b/src/librustc_codegen_llvm/type_.rs index 628b6fe39e6bf..aacaf130f9aa9 100644 --- a/src/librustc_codegen_llvm/type_.rs +++ b/src/librustc_codegen_llvm/type_.rs @@ -12,10 +12,10 @@ use crate::common; use crate::type_of::LayoutLlvmExt; use rustc::ty::layout::{self, Align, Size, TyLayout}; use rustc::ty::Ty; +use rustc_ast::ast; use rustc_codegen_ssa::common::TypeKind; use rustc_data_structures::small_c_str::SmallCStr; use rustc_target::abi::call::{CastTarget, FnAbi, Reg}; -use syntax::ast; use std::fmt; use std::ptr; diff --git a/src/librustc_codegen_ssa/Cargo.toml b/src/librustc_codegen_ssa/Cargo.toml index 8d767e5c2a04f..3181d568b013a 100644 --- a/src/librustc_codegen_ssa/Cargo.toml +++ b/src/librustc_codegen_ssa/Cargo.toml @@ -20,7 +20,7 @@ jobserver = "0.1.11" tempfile = "3.1" rustc_serialize = { path = "../libserialize", package = "serialize" } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } rustc_span = { path = "../librustc_span" } rustc = { path = "../librustc" } rustc_apfloat = { path = "../librustc_apfloat" } diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs index a6cd0c09684dd..3fe256ce25b96 100644 --- a/src/librustc_codegen_ssa/back/symbol_export.rs +++ b/src/librustc_codegen_ssa/back/symbol_export.rs @@ -8,6 +8,7 @@ use rustc::ty::query::Providers; use rustc::ty::subst::{GenericArgKind, SubstsRef}; use rustc::ty::Instance; use rustc::ty::{SymbolName, TyCtxt}; +use rustc_ast::expand::allocator::ALLOCATOR_METHODS; use rustc_codegen_utils::symbol_names; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::FxHashMap; @@ -15,7 +16,6 @@ use rustc_hir as hir; use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc_hir::Node; use rustc_index::vec::IndexVec; -use syntax::expand::allocator::ALLOCATOR_METHODS; pub fn threshold(tcx: TyCtxt<'_>) -> SymbolExportLevel { crates_export_threshold(&tcx.sess.crate_types.borrow()) diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs index 2cdbb204696c7..76728e9840616 100644 --- a/src/librustc_codegen_ssa/back/write.rs +++ b/src/librustc_codegen_ssa/back/write.rs @@ -19,6 +19,7 @@ use rustc::session::config::{ }; use rustc::session::Session; use rustc::ty::TyCtxt; +use rustc_ast::attr; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::profiling::SelfProfilerRef; use rustc_data_structures::profiling::TimingGuard; @@ -37,7 +38,6 @@ use rustc_span::hygiene::ExpnId; use rustc_span::source_map::SourceMap; use rustc_span::symbol::{sym, Symbol}; use rustc_target::spec::MergeFunctions; -use syntax::attr; use std::any::Any; use std::fs; diff --git a/src/librustc_codegen_ssa/traits/backend.rs b/src/librustc_codegen_ssa/traits/backend.rs index 7b22961cd46e2..5535841156acd 100644 --- a/src/librustc_codegen_ssa/traits/backend.rs +++ b/src/librustc_codegen_ssa/traits/backend.rs @@ -7,9 +7,9 @@ use rustc::session::{config, Session}; use rustc::ty::layout::{HasTyCtxt, LayoutOf, TyLayout}; use rustc::ty::Ty; use rustc::ty::TyCtxt; +use rustc_ast::expand::allocator::AllocatorKind; use rustc_codegen_utils::codegen_backend::CodegenBackend; use rustc_span::symbol::Symbol; -use syntax::expand::allocator::AllocatorKind; use std::sync::Arc; diff --git a/src/librustc_codegen_ssa/traits/debuginfo.rs b/src/librustc_codegen_ssa/traits/debuginfo.rs index 3688ae51b3918..14c5a1b8ee9b3 100644 --- a/src/librustc_codegen_ssa/traits/debuginfo.rs +++ b/src/librustc_codegen_ssa/traits/debuginfo.rs @@ -3,10 +3,10 @@ use crate::mir::debuginfo::{FunctionDebugContext, VariableKind}; use rustc::mir; use rustc::ty::layout::Size; use rustc::ty::{Instance, Ty}; +use rustc_ast::ast::Name; use rustc_hir::def_id::CrateNum; use rustc_span::{SourceFile, Span}; use rustc_target::abi::call::FnAbi; -use syntax::ast::Name; pub trait DebugInfoMethods<'tcx>: BackendTypes { fn create_vtable_metadata(&self, ty: Ty<'tcx>, vtable: Self::Value); diff --git a/src/librustc_codegen_utils/Cargo.toml b/src/librustc_codegen_utils/Cargo.toml index 8361a19ade9bc..b5533a8307c3d 100644 --- a/src/librustc_codegen_utils/Cargo.toml +++ b/src/librustc_codegen_utils/Cargo.toml @@ -14,7 +14,7 @@ log = "0.4" punycode = "0.4.0" rustc-demangle = "0.1.16" -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } rustc_span = { path = "../librustc_span" } rustc = { path = "../librustc" } rustc_hir = { path = "../librustc_hir" } diff --git a/src/librustc_codegen_utils/link.rs b/src/librustc_codegen_utils/link.rs index 92cbc42388d61..524fb0a59c2f1 100644 --- a/src/librustc_codegen_utils/link.rs +++ b/src/librustc_codegen_utils/link.rs @@ -1,9 +1,9 @@ use rustc::session::config::{self, Input, OutputFilenames, OutputType}; use rustc::session::Session; +use rustc_ast::{ast, attr}; use rustc_span::symbol::sym; use rustc_span::Span; use std::path::{Path, PathBuf}; -use syntax::{ast, attr}; pub fn out_filename( sess: &Session, diff --git a/src/librustc_codegen_utils/symbol_names/v0.rs b/src/librustc_codegen_utils/symbol_names/v0.rs index ff4e128e19090..ce6d0d9dc5ba8 100644 --- a/src/librustc_codegen_utils/symbol_names/v0.rs +++ b/src/librustc_codegen_utils/symbol_names/v0.rs @@ -2,12 +2,12 @@ use rustc::hir::map::{DefPathData, DisambiguatedDefPathData}; use rustc::ty::print::{Print, Printer}; use rustc::ty::subst::{GenericArg, GenericArgKind, Subst}; use rustc::ty::{self, Instance, Ty, TyCtxt, TypeFoldable}; +use rustc_ast::ast::{FloatTy, IntTy, UintTy}; use rustc_data_structures::base_n; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir as hir; use rustc_hir::def_id::{CrateNum, DefId}; use rustc_target::spec::abi::Abi; -use syntax::ast::{FloatTy, IntTy, UintTy}; use std::fmt::Write; use std::ops::Range; diff --git a/src/librustc_driver/Cargo.toml b/src/librustc_driver/Cargo.toml index 5b185f9a8b6b9..26f1741153c8c 100644 --- a/src/librustc_driver/Cargo.toml +++ b/src/librustc_driver/Cargo.toml @@ -31,7 +31,7 @@ rustc_codegen_utils = { path = "../librustc_codegen_utils" } rustc_error_codes = { path = "../librustc_error_codes" } rustc_interface = { path = "../librustc_interface" } rustc_serialize = { path = "../libserialize", package = "serialize" } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } rustc_span = { path = "../librustc_span" } [target.'cfg(windows)'.dependencies] diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index b00b1656bf750..9a94349e5fde4 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -55,10 +55,10 @@ use std::process::{self, Command, Stdio}; use std::str; use std::time::Instant; +use rustc_ast::ast; use rustc_span::source_map::FileLoader; use rustc_span::symbol::sym; use rustc_span::FileName; -use syntax::ast; mod args; pub mod pretty; diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index 236a7243998f6..ca129ac59849a 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -5,13 +5,13 @@ use rustc::session::config::{Input, PpMode, PpSourceMode}; use rustc::session::Session; use rustc::ty::{self, TyCtxt}; use rustc::util::common::ErrorReported; +use rustc_ast::ast; use rustc_ast_pretty::pprust; use rustc_hir as hir; use rustc_hir::def_id::LOCAL_CRATE; use rustc_hir::print as pprust_hir; use rustc_mir::util::{write_mir_graphviz, write_mir_pretty}; use rustc_span::FileName; -use syntax::ast; use std::cell::Cell; use std::fs::File; diff --git a/src/librustc_expand/Cargo.toml b/src/librustc_expand/Cargo.toml index cb7919d630ad4..3cb79030771b8 100644 --- a/src/librustc_expand/Cargo.toml +++ b/src/librustc_expand/Cargo.toml @@ -24,4 +24,4 @@ rustc_lexer = { path = "../librustc_lexer" } rustc_parse = { path = "../librustc_parse" } rustc_session = { path = "../librustc_session" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } diff --git a/src/librustc_expand/base.rs b/src/librustc_expand/base.rs index a5614f900b6fb..9258b59f79be8 100644 --- a/src/librustc_expand/base.rs +++ b/src/librustc_expand/base.rs @@ -1,5 +1,11 @@ use crate::expand::{self, AstFragment, Invocation}; +use rustc_ast::ast::{self, Attribute, Name, 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_attr::{self as attr, Deprecation, HasAttrs, Stability}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::{self, Lrc}; @@ -12,12 +18,6 @@ use rustc_span::source_map::SourceMap; use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::{FileName, MultiSpan, Span, DUMMY_SP}; use smallvec::{smallvec, SmallVec}; -use syntax::ast::{self, Attribute, Name, NodeId, PatKind}; -use syntax::mut_visit::{self, MutVisitor}; -use syntax::ptr::P; -use syntax::token; -use syntax::tokenstream::{self, TokenStream}; -use syntax::visit::{AssocCtxt, Visitor}; use std::default::Default; use std::iter; diff --git a/src/librustc_expand/build.rs b/src/librustc_expand/build.rs index bd6823cd4e275..48ceaf5fccd8e 100644 --- a/src/librustc_expand/build.rs +++ b/src/librustc_expand/build.rs @@ -1,10 +1,10 @@ use crate::base::ExtCtxt; +use rustc_ast::ast::{self, AttrVec, BlockCheckMode, Expr, Ident, PatKind, UnOp}; +use rustc_ast::attr; +use rustc_ast::ptr::P; use rustc_span::source_map::{respan, Spanned}; use rustc_span::symbol::{kw, sym, Symbol}; -use syntax::ast::{self, AttrVec, BlockCheckMode, Expr, Ident, PatKind, UnOp}; -use syntax::attr; -use syntax::ptr::P; use rustc_span::Span; diff --git a/src/librustc_expand/expand.rs b/src/librustc_expand/expand.rs index dff243a51b39f..a2c512fda91ba 100644 --- a/src/librustc_expand/expand.rs +++ b/src/librustc_expand/expand.rs @@ -5,6 +5,14 @@ use crate::mbe::macro_rules::annotate_err_with_kind; use crate::placeholders::{placeholder, PlaceholderExpander}; use crate::proc_macro::collect_derives; +use rustc_ast::ast::{self, AttrItem, Block, Ident, 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, TokenTree}; +use rustc_ast::util::map_in_place::MapInPlace; +use rustc_ast::visit::{self, AssocCtxt, Visitor}; use rustc_ast_pretty::pprust; use rustc_attr::{self as attr, is_builtin_attr, HasAttrs}; use rustc_data_structures::sync::Lrc; @@ -20,14 +28,6 @@ use rustc_session::parse::{feature_err, ParseSess}; use rustc_span::source_map::respan; use rustc_span::symbol::{sym, Symbol}; use rustc_span::{FileName, Span, DUMMY_SP}; -use syntax::ast::{self, AttrItem, Block, Ident, LitKind, NodeId, PatKind, Path}; -use syntax::ast::{ItemKind, MacArgs, MacStmtStyle, StmtKind}; -use syntax::mut_visit::*; -use syntax::ptr::P; -use syntax::token; -use syntax::tokenstream::{TokenStream, TokenTree}; -use syntax::util::map_in_place::MapInPlace; -use syntax::visit::{self, AssocCtxt, Visitor}; use smallvec::{smallvec, SmallVec}; use std::io::ErrorKind; diff --git a/src/librustc_expand/mbe.rs b/src/librustc_expand/mbe.rs index fe207a4c87687..57957a1fa8bf9 100644 --- a/src/librustc_expand/mbe.rs +++ b/src/librustc_expand/mbe.rs @@ -9,9 +9,9 @@ crate mod macro_rules; crate mod quoted; crate mod transcribe; -use syntax::ast; -use syntax::token::{self, Token, TokenKind}; -use syntax::tokenstream::DelimSpan; +use rustc_ast::ast; +use rustc_ast::token::{self, Token, TokenKind}; +use rustc_ast::tokenstream::DelimSpan; use rustc_span::Span; diff --git a/src/librustc_expand/mbe/macro_check.rs b/src/librustc_expand/mbe/macro_check.rs index 10cdceefdf579..6eb834beac652 100644 --- a/src/librustc_expand/mbe/macro_check.rs +++ b/src/librustc_expand/mbe/macro_check.rs @@ -106,13 +106,13 @@ //! bound. use crate::mbe::{KleeneToken, TokenTree}; +use rustc_ast::ast::NodeId; +use rustc_ast::token::{DelimToken, Token, TokenKind}; use rustc_data_structures::fx::FxHashMap; use rustc_session::lint::builtin::META_VARIABLE_MISUSE; use rustc_session::parse::ParseSess; use rustc_span::symbol::kw; use rustc_span::{symbol::Ident, MultiSpan, Span}; -use syntax::ast::NodeId; -use syntax::token::{DelimToken, Token, TokenKind}; use smallvec::SmallVec; diff --git a/src/librustc_expand/mbe/macro_parser.rs b/src/librustc_expand/mbe/macro_parser.rs index 2a53d600c5bcf..d2a5c54aae490 100644 --- a/src/librustc_expand/mbe/macro_parser.rs +++ b/src/librustc_expand/mbe/macro_parser.rs @@ -76,13 +76,13 @@ use TokenTreeOrTokenTreeSlice::*; use crate::mbe::{self, TokenTree}; +use rustc_ast::ast::{Ident, Name}; +use rustc_ast::ptr::P; +use rustc_ast::token::{self, DocComment, Nonterminal, Token}; use rustc_ast_pretty::pprust; use rustc_parse::parser::{FollowedByType, Parser, PathStyle}; use rustc_session::parse::ParseSess; use rustc_span::symbol::{kw, sym, Symbol}; -use syntax::ast::{Ident, Name}; -use syntax::ptr::P; -use syntax::token::{self, DocComment, Nonterminal, Token}; use rustc_errors::{FatalError, PResult}; use rustc_span::Span; diff --git a/src/librustc_expand/mbe/macro_rules.rs b/src/librustc_expand/mbe/macro_rules.rs index 52e581e30f537..02f2a386b33eb 100644 --- a/src/librustc_expand/mbe/macro_rules.rs +++ b/src/librustc_expand/mbe/macro_rules.rs @@ -8,6 +8,9 @@ use crate::mbe::macro_parser::{Error, Failure, Success}; use crate::mbe::macro_parser::{MatchedNonterminal, MatchedSeq}; use crate::mbe::transcribe::transcribe; +use rustc_ast::ast; +use rustc_ast::token::{self, NtTT, Token, TokenKind::*}; +use rustc_ast::tokenstream::{DelimSpan, TokenStream}; use rustc_ast_pretty::pprust; use rustc_attr::{self as attr, TransparencyError}; use rustc_data_structures::fx::FxHashMap; @@ -21,9 +24,6 @@ use rustc_span::edition::Edition; use rustc_span::hygiene::Transparency; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::Span; -use syntax::ast; -use syntax::token::{self, NtTT, Token, TokenKind::*}; -use syntax::tokenstream::{DelimSpan, TokenStream}; use log::debug; use std::borrow::Cow; diff --git a/src/librustc_expand/mbe/quoted.rs b/src/librustc_expand/mbe/quoted.rs index 809bbe47a6e75..b19fae6559704 100644 --- a/src/librustc_expand/mbe/quoted.rs +++ b/src/librustc_expand/mbe/quoted.rs @@ -1,12 +1,12 @@ use crate::mbe::macro_parser; use crate::mbe::{Delimited, KleeneOp, KleeneToken, SequenceRepetition, TokenTree}; +use rustc_ast::ast; +use rustc_ast::token::{self, Token}; +use rustc_ast::tokenstream; use rustc_ast_pretty::pprust; use rustc_session::parse::ParseSess; use rustc_span::symbol::kw; -use syntax::ast; -use syntax::token::{self, Token}; -use syntax::tokenstream; use rustc_span::Span; diff --git a/src/librustc_expand/mbe/transcribe.rs b/src/librustc_expand/mbe/transcribe.rs index 9e6a2c4f8f550..80bf02b1366e0 100644 --- a/src/librustc_expand/mbe/transcribe.rs +++ b/src/librustc_expand/mbe/transcribe.rs @@ -2,15 +2,15 @@ use crate::base::ExtCtxt; use crate::mbe; use crate::mbe::macro_parser::{MatchedNonterminal, MatchedSeq, NamedMatch}; +use rustc_ast::ast::{Ident, Mac}; +use rustc_ast::mut_visit::{self, MutVisitor}; +use rustc_ast::token::{self, NtTT, Token}; +use rustc_ast::tokenstream::{DelimSpan, TokenStream, TokenTree, TreeAndJoint}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::Lrc; use rustc_errors::pluralize; use rustc_span::hygiene::{ExpnId, Transparency}; use rustc_span::Span; -use syntax::ast::{Ident, Mac}; -use syntax::mut_visit::{self, MutVisitor}; -use syntax::token::{self, NtTT, Token}; -use syntax::tokenstream::{DelimSpan, TokenStream, TokenTree, TreeAndJoint}; use smallvec::{smallvec, SmallVec}; use std::mem; diff --git a/src/librustc_expand/mut_visit/tests.rs b/src/librustc_expand/mut_visit/tests.rs index 49b9a1b1025ab..4c947d8fa2b4e 100644 --- a/src/librustc_expand/mut_visit/tests.rs +++ b/src/librustc_expand/mut_visit/tests.rs @@ -1,9 +1,9 @@ use crate::tests::{matches_codepattern, string_to_crate}; +use rustc_ast::ast::{self, Ident}; +use rustc_ast::mut_visit::{self, MutVisitor}; +use rustc_ast::with_default_globals; use rustc_ast_pretty::pprust; -use syntax::ast::{self, Ident}; -use syntax::mut_visit::{self, MutVisitor}; -use syntax::with_default_globals; // This version doesn't care about getting comments or doc-strings in. fn fake_print_crate(s: &mut pprust::State<'_>, krate: &ast::Crate) { diff --git a/src/librustc_expand/parse/lexer/tests.rs b/src/librustc_expand/parse/lexer/tests.rs index c486839dad506..2cb6267e0f6aa 100644 --- a/src/librustc_expand/parse/lexer/tests.rs +++ b/src/librustc_expand/parse/lexer/tests.rs @@ -1,3 +1,6 @@ +use rustc_ast::token::{self, Token, TokenKind}; +use rustc_ast::util::comments::is_doc_comment; +use rustc_ast::with_default_globals; use rustc_data_structures::sync::Lrc; use rustc_errors::{emitter::EmitterWriter, Handler}; use rustc_parse::lexer::StringReader; @@ -5,9 +8,6 @@ use rustc_session::parse::ParseSess; use rustc_span::source_map::{FilePathMapping, SourceMap}; use rustc_span::symbol::Symbol; use rustc_span::{BytePos, Span}; -use syntax::token::{self, Token, TokenKind}; -use syntax::util::comments::is_doc_comment; -use syntax::with_default_globals; use std::io; use std::path::PathBuf; diff --git a/src/librustc_expand/parse/tests.rs b/src/librustc_expand/parse/tests.rs index 4713c8dcd9a3b..55e815bd4a4e0 100644 --- a/src/librustc_expand/parse/tests.rs +++ b/src/librustc_expand/parse/tests.rs @@ -1,5 +1,11 @@ use crate::tests::{matches_codepattern, string_to_stream, with_error_checking_parse}; +use rustc_ast::ast::{self, Name, 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::with_default_globals; use rustc_ast_pretty::pprust::item_to_string; use rustc_errors::PResult; use rustc_parse::new_parser_from_source_str; @@ -7,12 +13,6 @@ use rustc_session::parse::ParseSess; use rustc_span::source_map::FilePathMapping; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::{BytePos, FileName, Pos, Span}; -use syntax::ast::{self, Name, PatKind}; -use syntax::ptr::P; -use syntax::token::{self, Token}; -use syntax::tokenstream::{DelimSpan, TokenStream, TokenTree}; -use syntax::visit; -use syntax::with_default_globals; use std::path::PathBuf; diff --git a/src/librustc_expand/placeholders.rs b/src/librustc_expand/placeholders.rs index c323af4336a4c..cd4f0a61d424a 100644 --- a/src/librustc_expand/placeholders.rs +++ b/src/librustc_expand/placeholders.rs @@ -1,10 +1,10 @@ use crate::base::ExtCtxt; use crate::expand::{AstFragment, AstFragmentKind}; +use rustc_ast::ast; +use rustc_ast::mut_visit::*; +use rustc_ast::ptr::P; use rustc_span::source_map::{dummy_spanned, DUMMY_SP}; -use syntax::ast; -use syntax::mut_visit::*; -use syntax::ptr::P; use smallvec::{smallvec, SmallVec}; diff --git a/src/librustc_expand/proc_macro.rs b/src/librustc_expand/proc_macro.rs index cb6249e936976..84a546345bb28 100644 --- a/src/librustc_expand/proc_macro.rs +++ b/src/librustc_expand/proc_macro.rs @@ -1,13 +1,13 @@ 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::{self, TokenStream}; use rustc_data_structures::sync::Lrc; use rustc_errors::{Applicability, FatalError}; use rustc_span::symbol::sym; use rustc_span::{Span, DUMMY_SP}; -use syntax::ast::{self, ItemKind, MetaItemKind, NestedMetaItem}; -use syntax::token; -use syntax::tokenstream::{self, TokenStream}; const EXEC_STRATEGY: pm::bridge::server::SameThread = pm::bridge::server::SameThread; diff --git a/src/librustc_expand/proc_macro_server.rs b/src/librustc_expand/proc_macro_server.rs index ce4e262068c56..5f21ff503d59e 100644 --- a/src/librustc_expand/proc_macro_server.rs +++ b/src/librustc_expand/proc_macro_server.rs @@ -1,5 +1,9 @@ use crate::base::ExtCtxt; +use rustc_ast::ast; +use rustc_ast::token; +use rustc_ast::tokenstream::{self, DelimSpan, IsJoint::*, TokenStream, TreeAndJoint}; +use rustc_ast::util::comments; use rustc_ast_pretty::pprust; use rustc_data_structures::sync::Lrc; use rustc_errors::Diagnostic; @@ -8,10 +12,6 @@ use rustc_parse::{nt_to_tokenstream, parse_stream_from_source_str}; use rustc_session::parse::ParseSess; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::{BytePos, FileName, MultiSpan, Pos, SourceFile, Span}; -use syntax::ast; -use syntax::token; -use syntax::tokenstream::{self, DelimSpan, IsJoint::*, TokenStream, TreeAndJoint}; -use syntax::util::comments; use pm::bridge::{server, TokenTree}; use pm::{Delimiter, Level, LineColumn, Spacing}; @@ -54,7 +54,7 @@ impl FromInternal<(TreeAndJoint, &'_ ParseSess, &'_ mut Vec)> fn from_internal( ((tree, is_joint), sess, stack): (TreeAndJoint, &ParseSess, &mut Vec), ) -> Self { - use syntax::token::*; + use rustc_ast::token::*; let joint = is_joint == Joint; let Token { kind, span } = match tree { @@ -191,7 +191,7 @@ impl FromInternal<(TreeAndJoint, &'_ ParseSess, &'_ mut Vec)> impl ToInternal for TokenTree { fn to_internal(self) -> TokenStream { - use syntax::token::*; + use rustc_ast::token::*; let (ch, joint, span) = match self { TokenTree::Punct(Punct { ch, joint, span }) => (ch, joint, span), diff --git a/src/librustc_expand/tests.rs b/src/librustc_expand/tests.rs index 4ed60465f24f2..fbc49ddd562b5 100644 --- a/src/librustc_expand/tests.rs +++ b/src/librustc_expand/tests.rs @@ -1,10 +1,10 @@ +use rustc_ast::ast; +use rustc_ast::tokenstream::TokenStream; +use rustc_ast::with_default_globals; use rustc_parse::{new_parser_from_source_str, parser::Parser, source_file_to_stream}; use rustc_session::parse::ParseSess; use rustc_span::source_map::{FilePathMapping, SourceMap}; use rustc_span::{BytePos, MultiSpan, Span}; -use syntax::ast; -use syntax::tokenstream::TokenStream; -use syntax::with_default_globals; use rustc_data_structures::sync::Lrc; use rustc_errors::emitter::EmitterWriter; diff --git a/src/librustc_expand/tokenstream/tests.rs b/src/librustc_expand/tokenstream/tests.rs index 287c168f76a19..db329f22d146f 100644 --- a/src/librustc_expand/tokenstream/tests.rs +++ b/src/librustc_expand/tokenstream/tests.rs @@ -1,11 +1,11 @@ use crate::tests::string_to_stream; +use rustc_ast::ast::Name; +use rustc_ast::token; +use rustc_ast::tokenstream::{TokenStream, TokenStreamBuilder, TokenTree}; +use rustc_ast::with_default_globals; use rustc_span::{BytePos, Span}; use smallvec::smallvec; -use syntax::ast::Name; -use syntax::token; -use syntax::tokenstream::{TokenStream, TokenStreamBuilder, TokenTree}; -use syntax::with_default_globals; fn string_to_ts(string: &str) -> TokenStream { string_to_stream(string.to_owned()) diff --git a/src/librustc_hir/Cargo.toml b/src/librustc_hir/Cargo.toml index cff6413253202..872d114fb1800 100644 --- a/src/librustc_hir/Cargo.toml +++ b/src/librustc_hir/Cargo.toml @@ -18,6 +18,6 @@ rustc_index = { path = "../librustc_index" } rustc_span = { path = "../librustc_span" } rustc_errors = { path = "../librustc_errors" } rustc_serialize = { path = "../libserialize", package = "serialize" } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } lazy_static = "1" smallvec = { version = "1.0", features = ["union", "may_dangle"] } diff --git a/src/librustc_hir/def.rs b/src/librustc_hir/def.rs index 83e30d85c5a67..595543eaf535f 100644 --- a/src/librustc_hir/def.rs +++ b/src/librustc_hir/def.rs @@ -1,10 +1,10 @@ use crate::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use crate::hir; +use rustc_ast::ast; +use rustc_ast::ast::NodeId; use rustc_macros::HashStable_Generic; use rustc_span::hygiene::MacroKind; -use syntax::ast; -use syntax::ast::NodeId; use std::fmt::Debug; diff --git a/src/librustc_hir/hir.rs b/src/librustc_hir/hir.rs index 6cbd8400783b4..1a74b50b57e7f 100644 --- a/src/librustc_hir/hir.rs +++ b/src/librustc_hir/hir.rs @@ -8,6 +8,13 @@ crate use BlockCheckMode::*; crate use FnRetTy::*; crate use UnsafeSource::*; +use rustc_ast::ast::{self, AsmDialect, CrateSugar, Ident, Name}; +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::node_id::NodeMap; +use rustc_ast::tokenstream::TokenStream; +use rustc_ast::util::parser::ExprPrecedence; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::sync::{par_for_each_in, Send, Sync}; use rustc_errors::FatalError; @@ -16,13 +23,6 @@ use rustc_span::source_map::{SourceMap, Spanned}; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::{MultiSpan, Span, DUMMY_SP}; use rustc_target::spec::abi::Abi; -use syntax::ast::{self, AsmDialect, CrateSugar, Ident, Name}; -use syntax::ast::{AttrVec, Attribute, FloatTy, IntTy, Label, LitKind, StrStyle, UintTy}; -pub use syntax::ast::{BorrowKind, ImplPolarity, IsAuto}; -pub use syntax::ast::{CaptureBy, Movability, Mutability}; -use syntax::node_id::NodeMap; -use syntax::tokenstream::TokenStream; -use syntax::util::parser::ExprPrecedence; use smallvec::SmallVec; use std::collections::{BTreeMap, BTreeSet}; diff --git a/src/librustc_hir/intravisit.rs b/src/librustc_hir/intravisit.rs index f574449c6b954..45257b04d7907 100644 --- a/src/librustc_hir/intravisit.rs +++ b/src/librustc_hir/intravisit.rs @@ -34,9 +34,9 @@ use crate::hir::*; use crate::hir_id::CRATE_HIR_ID; use crate::itemlikevisit::{ItemLikeVisitor, ParItemLikeVisitor}; +use rustc_ast::ast::{Attribute, Ident, Label, Name}; +use rustc_ast::walk_list; use rustc_span::Span; -use syntax::ast::{Attribute, Ident, Label, Name}; -use syntax::walk_list; pub struct DeepVisitor<'v, V> { visitor: &'v mut V, diff --git a/src/librustc_hir/lang_items.rs b/src/librustc_hir/lang_items.rs index cb5ebba463394..fc91b68e3ea44 100644 --- a/src/librustc_hir/lang_items.rs +++ b/src/librustc_hir/lang_items.rs @@ -12,12 +12,12 @@ pub use self::LangItem::*; use crate::def_id::DefId; use crate::Target; +use rustc_ast::ast; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_macros::HashStable_Generic; use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; -use syntax::ast; use lazy_static::lazy_static; diff --git a/src/librustc_hir/pat_util.rs b/src/librustc_hir/pat_util.rs index 6bca45b4f8397..0b9ffdf21fe8e 100644 --- a/src/librustc_hir/pat_util.rs +++ b/src/librustc_hir/pat_util.rs @@ -1,8 +1,8 @@ use crate::def::{CtorOf, DefKind, Res}; use crate::def_id::DefId; use crate::hir::{self, HirId, PatKind}; +use rustc_ast::ast; use rustc_span::Span; -use syntax::ast; use std::iter::{Enumerate, ExactSizeIterator}; diff --git a/src/librustc_hir/print.rs b/src/librustc_hir/print.rs index 3fde04c294ef2..8cbbef959ce75 100644 --- a/src/librustc_hir/print.rs +++ b/src/librustc_hir/print.rs @@ -1,3 +1,5 @@ +use rustc_ast::ast; +use rustc_ast::util::parser::{self, AssocOp, Fixity}; use rustc_ast_pretty::pp::Breaks::{Consistent, Inconsistent}; use rustc_ast_pretty::pp::{self, Breaks}; use rustc_ast_pretty::pprust::{Comments, PrintState}; @@ -5,8 +7,6 @@ use rustc_span::source_map::{SourceMap, Spanned}; use rustc_span::symbol::{kw, IdentPrinter}; use rustc_span::{self, BytePos, FileName}; use rustc_target::spec::abi::Abi; -use syntax::ast; -use syntax::util::parser::{self, AssocOp, Fixity}; use crate::hir; use crate::hir::{GenericArg, GenericParam, GenericParamKind, Node}; diff --git a/src/librustc_hir/stable_hash_impls.rs b/src/librustc_hir/stable_hash_impls.rs index e8407b537011b..3938a0369b924 100644 --- a/src/librustc_hir/stable_hash_impls.rs +++ b/src/librustc_hir/stable_hash_impls.rs @@ -6,7 +6,9 @@ use crate::hir_id::HirId; /// Requirements for a `StableHashingContext` to be used in this crate. /// This is a hack to allow using the `HashStable_Generic` derive macro /// instead of implementing everything in librustc. -pub trait HashStableContext: syntax::HashStableContext + rustc_target::HashStableContext { +pub trait HashStableContext: + rustc_ast::HashStableContext + rustc_target::HashStableContext +{ fn hash_hir_id(&mut self, _: HirId, hasher: &mut StableHasher); fn hash_body_id(&mut self, _: BodyId, hasher: &mut StableHasher); fn hash_reference_to_item(&mut self, _: HirId, hasher: &mut StableHasher); diff --git a/src/librustc_hir/weak_lang_items.rs b/src/librustc_hir/weak_lang_items.rs index 79182caae8c80..405a31d5a69ad 100644 --- a/src/librustc_hir/weak_lang_items.rs +++ b/src/librustc_hir/weak_lang_items.rs @@ -3,9 +3,9 @@ use crate::def_id::DefId; use crate::{lang_items, LangItem, LanguageItems}; +use rustc_ast::ast; use rustc_data_structures::fx::FxHashMap; use rustc_span::symbol::{sym, Symbol}; -use syntax::ast; use lazy_static::lazy_static; diff --git a/src/librustc_incremental/Cargo.toml b/src/librustc_incremental/Cargo.toml index 09b33a6c83d8d..eddfb81ea8b0a 100644 --- a/src/librustc_incremental/Cargo.toml +++ b/src/librustc_incremental/Cargo.toml @@ -17,7 +17,7 @@ rustc = { path = "../librustc" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_hir = { path = "../librustc_hir" } rustc_serialize = { path = "../libserialize", package = "serialize" } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } rustc_span = { path = "../librustc_span" } rustc_fs_util = { path = "../librustc_fs_util" } rustc_session = { path = "../librustc_session" } diff --git a/src/librustc_incremental/assert_dep_graph.rs b/src/librustc_incremental/assert_dep_graph.rs index 51cc091b6c0af..c82ed0c2c4970 100644 --- a/src/librustc_incremental/assert_dep_graph.rs +++ b/src/librustc_incremental/assert_dep_graph.rs @@ -38,6 +38,7 @@ use rustc::dep_graph::debug::{DepNodeFilter, EdgeFilter}; use rustc::dep_graph::{DepGraphQuery, DepKind, DepNode}; use rustc::hir::map::Map; use rustc::ty::TyCtxt; +use rustc_ast::ast; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::graph::implementation::{Direction, NodeIndex, INCOMING, OUTGOING}; use rustc_hir as hir; @@ -45,7 +46,6 @@ use rustc_hir::def_id::DefId; use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc_span::symbol::sym; use rustc_span::Span; -use syntax::ast; use std::env; use std::fs::{self, File}; diff --git a/src/librustc_incremental/assert_module_sources.rs b/src/librustc_incremental/assert_module_sources.rs index 4dd08b517e1f2..261540abcad5d 100644 --- a/src/librustc_incremental/assert_module_sources.rs +++ b/src/librustc_incremental/assert_module_sources.rs @@ -23,11 +23,11 @@ use rustc::mir::mono::CodegenUnitNameBuilder; use rustc::ty::TyCtxt; +use rustc_ast::ast; use rustc_hir::def_id::LOCAL_CRATE; use rustc_session::cgu_reuse_tracker::*; use rustc_span::symbol::{sym, Symbol}; use std::collections::BTreeSet; -use syntax::ast; pub fn assert_module_sources(tcx: TyCtxt<'_>) { tcx.dep_graph.with_ignore(|| { diff --git a/src/librustc_incremental/persist/dirty_clean.rs b/src/librustc_incremental/persist/dirty_clean.rs index f6e2956e5b2fc..f304292d922e5 100644 --- a/src/librustc_incremental/persist/dirty_clean.rs +++ b/src/librustc_incremental/persist/dirty_clean.rs @@ -16,6 +16,7 @@ use rustc::dep_graph::{label_strs, DepNode}; use rustc::hir::map::Map; use rustc::ty::TyCtxt; +use rustc_ast::ast::{self, Attribute, NestedMetaItem}; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::FxHashSet; use rustc_hir as hir; @@ -28,7 +29,6 @@ use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; use std::iter::FromIterator; use std::vec::Vec; -use syntax::ast::{self, Attribute, NestedMetaItem}; const EXCEPT: Symbol = sym::except; const LABEL: Symbol = sym::label; @@ -168,7 +168,7 @@ pub fn check_dirty_clean_annotations(tcx: TyCtxt<'_>) { // Note that we cannot use the existing "unused attribute"-infrastructure // here, since that is running before codegen. This is also the reason why - // all codegen-specific attributes are `Whitelisted` in syntax::feature_gate. + // all codegen-specific attributes are `Whitelisted` in rustc_ast::feature_gate. all_attrs.report_unchecked_attrs(&dirty_clean_visitor.checked_attrs); }) } diff --git a/src/librustc_infer/Cargo.toml b/src/librustc_infer/Cargo.toml index 53970a4aaf315..de99214901d9b 100644 --- a/src/librustc_infer/Cargo.toml +++ b/src/librustc_infer/Cargo.toml @@ -25,4 +25,4 @@ rustc_session = { path = "../librustc_session" } rustc_span = { path = "../librustc_span" } rustc_target = { path = "../librustc_target" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } diff --git a/src/librustc_infer/infer/combine.rs b/src/librustc_infer/infer/combine.rs index a10af56a0f0a8..9d06e26d9bb3c 100644 --- a/src/librustc_infer/infer/combine.rs +++ b/src/librustc_infer/infer/combine.rs @@ -39,9 +39,9 @@ use rustc::ty::relate::{self, Relate, RelateResult, TypeRelation}; use rustc::ty::subst::SubstsRef; use rustc::ty::{self, InferConst, Ty, TyCtxt}; use rustc::ty::{IntType, UintType}; +use rustc_ast::ast; use rustc_hir::def_id::DefId; use rustc_span::{Span, DUMMY_SP}; -use syntax::ast; #[derive(Clone)] pub struct CombineFields<'infcx, 'tcx> { diff --git a/src/librustc_infer/infer/mod.rs b/src/librustc_infer/infer/mod.rs index 26998f0a33c2e..11b08d468b1b9 100644 --- a/src/librustc_infer/infer/mod.rs +++ b/src/librustc_infer/infer/mod.rs @@ -25,6 +25,7 @@ use rustc::ty::subst::{GenericArg, InternalSubsts, SubstsRef}; use rustc::ty::{self, GenericParamDefKind, InferConst, Ty, TyCtxt}; use rustc::ty::{ConstVid, FloatVid, IntVid, TyVid}; +use rustc_ast::ast; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::sync::Lrc; use rustc_data_structures::unify as ut; @@ -36,7 +37,6 @@ use rustc_span::Span; use std::cell::{Cell, Ref, RefCell}; use std::collections::BTreeMap; use std::fmt; -use syntax::ast; use self::combine::CombineFields; use self::lexical_region_resolve::LexicalRegionResolutions; diff --git a/src/librustc_infer/traits/error_reporting/mod.rs b/src/librustc_infer/traits/error_reporting/mod.rs index a2fe0236aecbd..471f388f0bb18 100644 --- a/src/librustc_infer/traits/error_reporting/mod.rs +++ b/src/librustc_infer/traits/error_reporting/mod.rs @@ -21,6 +21,7 @@ use rustc::ty::SubtypePredicate; use rustc::ty::{ self, AdtKind, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, TypeFoldable, WithConstness, }; +use rustc_ast::ast; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder}; use rustc_hir as hir; @@ -29,7 +30,6 @@ use rustc_hir::{QPath, TyKind, WhereBoundPredicate, WherePredicate}; use rustc_span::source_map::SourceMap; use rustc_span::{ExpnKind, Span, DUMMY_SP}; use std::fmt; -use syntax::ast; impl<'a, 'tcx> InferCtxt<'a, 'tcx> { pub fn report_fulfillment_errors( diff --git a/src/librustc_infer/traits/on_unimplemented.rs b/src/librustc_infer/traits/on_unimplemented.rs index 41201c1c7ae7c..04d7772de83e0 100644 --- a/src/librustc_infer/traits/on_unimplemented.rs +++ b/src/librustc_infer/traits/on_unimplemented.rs @@ -3,13 +3,13 @@ use fmt_macros::{Parser, Piece, Position}; use rustc::ty::{self, GenericParamDefKind, TyCtxt}; use rustc::util::common::ErrorReported; +use rustc_ast::ast::{MetaItem, NestedMetaItem}; use rustc_attr as attr; use rustc_data_structures::fx::FxHashMap; use rustc_errors::struct_span_err; use rustc_hir::def_id::DefId; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::Span; -use syntax::ast::{MetaItem, NestedMetaItem}; #[derive(Clone, Debug)] pub struct OnUnimplementedFormatString(Symbol); diff --git a/src/librustc_infer/traits/project.rs b/src/librustc_infer/traits/project.rs index 8d9e5d3fa20fb..cbe24320502a2 100644 --- a/src/librustc_infer/traits/project.rs +++ b/src/librustc_infer/traits/project.rs @@ -17,11 +17,11 @@ use crate::infer::{InferCtxt, InferOk, LateBoundRegionConversionTime}; use rustc::ty::fold::{TypeFoldable, TypeFolder}; use rustc::ty::subst::{InternalSubsts, Subst}; use rustc::ty::{self, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, WithConstness}; +use rustc_ast::ast::Ident; use rustc_data_structures::snapshot_map::{Snapshot, SnapshotMap}; use rustc_hir::def_id::DefId; use rustc_span::symbol::sym; use rustc_span::DUMMY_SP; -use syntax::ast::Ident; pub use rustc::traits::Reveal; diff --git a/src/librustc_infer/traits/select.rs b/src/librustc_infer/traits/select.rs index 925665763cbe5..d468e28ba4d26 100644 --- a/src/librustc_infer/traits/select.rs +++ b/src/librustc_infer/traits/select.rs @@ -40,13 +40,13 @@ use rustc::ty::fast_reject; use rustc::ty::relate::TypeRelation; use rustc::ty::subst::{Subst, SubstsRef}; use rustc::ty::{self, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, TypeFoldable, WithConstness}; +use rustc_ast::attr; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_index::bit_set::GrowableBitSet; use rustc_span::symbol::sym; use rustc_target::spec::abi::Abi; -use syntax::attr; use std::cell::{Cell, RefCell}; use std::cmp; diff --git a/src/librustc_interface/Cargo.toml b/src/librustc_interface/Cargo.toml index b3ac5b0fc548a..b29480a88109f 100644 --- a/src/librustc_interface/Cargo.toml +++ b/src/librustc_interface/Cargo.toml @@ -13,7 +13,7 @@ doctest = false log = "0.4" rayon = { version = "0.3.0", package = "rustc-rayon" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } rustc_attr = { path = "../librustc_attr" } rustc_builtin_macros = { path = "../librustc_builtin_macros" } rustc_expand = { path = "../librustc_expand" } diff --git a/src/librustc_interface/callbacks.rs b/src/librustc_interface/callbacks.rs index 7c8e682e9fb18..0345b82d3bbc6 100644 --- a/src/librustc_interface/callbacks.rs +++ b/src/librustc_interface/callbacks.rs @@ -13,7 +13,7 @@ use rustc::ty::tls; use rustc_errors::{Diagnostic, TRACK_DIAGNOSTICS}; use std::fmt; -/// This is a callback from libsyntax as it cannot access the implicit state +/// This is a callback from librustc_ast as it cannot access the implicit state /// in librustc otherwise. fn span_debug(span: rustc_span::Span, f: &mut fmt::Formatter<'_>) -> fmt::Result { tls::with_opt(|tcx| { @@ -25,7 +25,7 @@ fn span_debug(span: rustc_span::Span, f: &mut fmt::Formatter<'_>) -> fmt::Result }) } -/// This is a callback from libsyntax as it cannot access the implicit state +/// This is a callback from librustc_ast as it cannot access the implicit state /// in librustc otherwise. It is used to when diagnostic messages are /// emitted and stores them in the current query, if there is one. fn track_diagnostic(diagnostic: &Diagnostic) { diff --git a/src/librustc_interface/interface.rs b/src/librustc_interface/interface.rs index e213a4d33a6fb..e15217dfa67e6 100644 --- a/src/librustc_interface/interface.rs +++ b/src/librustc_interface/interface.rs @@ -7,6 +7,8 @@ use rustc::session::early_error; use rustc::session::{DiagnosticOutput, Session}; use rustc::ty; use rustc::util::common::ErrorReported; +use rustc_ast::ast::{self, MetaItemKind}; +use rustc_ast::token; use rustc_codegen_utils::codegen_backend::CodegenBackend; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::sync::Lrc; @@ -20,8 +22,6 @@ use rustc_span::source_map::{FileLoader, FileName, SourceMap}; use std::path::PathBuf; use std::result; use std::sync::{Arc, Mutex}; -use syntax::ast::{self, MetaItemKind}; -use syntax::token; pub type Result = result::Result; @@ -78,7 +78,7 @@ impl Compiler { /// Converts strings provided as `--cfg [cfgspec]` into a `crate_cfg`. pub fn parse_cfgspecs(cfgspecs: Vec) -> FxHashSet<(String, Option)> { - syntax::with_default_globals(move || { + rustc_ast::with_default_globals(move || { let cfg = cfgspecs .into_iter() .map(|s| { diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index 96a2ac08f2c49..1e9b76c3e14d2 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -16,6 +16,8 @@ use rustc::session::Session; use rustc::ty::steal::Steal; use rustc::ty::{self, GlobalCtxt, ResolverOutputs, TyCtxt}; use rustc::util::common::ErrorReported; +use rustc_ast::mut_visit::MutVisitor; +use rustc_ast::{self, ast, visit}; use rustc_codegen_ssa::back::link::emit_metadata; use rustc_codegen_utils::codegen_backend::CodegenBackend; use rustc_codegen_utils::link::filename_for_metadata; @@ -36,8 +38,6 @@ use rustc_resolve::{Resolver, ResolverArenas}; use rustc_span::symbol::Symbol; use rustc_span::FileName; use rustc_typeck as typeck; -use syntax::mut_visit::MutVisitor; -use syntax::{self, ast, visit}; use rustc_serialize::json; use tempfile::Builder as TempFileBuilder; diff --git a/src/librustc_interface/proc_macro_decls.rs b/src/librustc_interface/proc_macro_decls.rs index 9238f88b2b527..076a8cef92cbc 100644 --- a/src/librustc_interface/proc_macro_decls.rs +++ b/src/librustc_interface/proc_macro_decls.rs @@ -1,10 +1,10 @@ use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_ast::attr; use rustc_hir as hir; use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_span::symbol::sym; -use syntax::attr; pub fn find(tcx: TyCtxt<'_>) -> Option { tcx.proc_macro_decls_static(LOCAL_CRATE) diff --git a/src/librustc_interface/queries.rs b/src/librustc_interface/queries.rs index 0c77ab57500a0..426d97cc09b92 100644 --- a/src/librustc_interface/queries.rs +++ b/src/librustc_interface/queries.rs @@ -8,6 +8,7 @@ use rustc::session::Session; use rustc::ty::steal::Steal; use rustc::ty::{GlobalCtxt, ResolverOutputs}; use rustc::util::common::ErrorReported; +use rustc_ast::{self, ast}; use rustc_codegen_utils::codegen_backend::CodegenBackend; use rustc_data_structures::sync::{Lrc, Once, WorkerLocal}; use rustc_hir::def_id::LOCAL_CRATE; @@ -18,7 +19,6 @@ use std::any::Any; use std::cell::{Ref, RefCell, RefMut}; use std::mem; use std::rc::Rc; -use syntax::{self, ast}; /// Represent the result of a query. /// This result can be stolen with the `take` method and generated with the `compute` method. diff --git a/src/librustc_interface/tests.rs b/src/librustc_interface/tests.rs index ec75a1c6a3938..1b80cf4e3dbc2 100644 --- a/src/librustc_interface/tests.rs +++ b/src/librustc_interface/tests.rs @@ -18,7 +18,6 @@ use rustc_target::spec::{MergeFunctions, PanicStrategy, RelroLevel}; use std::collections::{BTreeMap, BTreeSet}; use std::iter::FromIterator; use std::path::PathBuf; -use syntax; type CfgSpecs = FxHashSet<(String, Option)>; @@ -64,7 +63,7 @@ fn mk_map(entries: Vec<(K, V)>) -> BTreeMap { // When the user supplies --test we should implicitly supply --cfg test #[test] fn test_switch_implies_cfg_test() { - syntax::with_default_globals(|| { + rustc_ast::with_default_globals(|| { let matches = optgroups().parse(&["--test".to_string()]).unwrap(); let (sess, cfg) = mk_session(matches); let cfg = build_configuration(&sess, to_crate_config(cfg)); @@ -75,7 +74,7 @@ fn test_switch_implies_cfg_test() { // When the user supplies --test and --cfg test, don't implicitly add another --cfg test #[test] fn test_switch_implies_cfg_test_unless_cfg_test() { - syntax::with_default_globals(|| { + rustc_ast::with_default_globals(|| { let matches = optgroups().parse(&["--test".to_string(), "--cfg=test".to_string()]).unwrap(); let (sess, cfg) = mk_session(matches); let cfg = build_configuration(&sess, to_crate_config(cfg)); @@ -87,20 +86,20 @@ fn test_switch_implies_cfg_test_unless_cfg_test() { #[test] fn test_can_print_warnings() { - syntax::with_default_globals(|| { + rustc_ast::with_default_globals(|| { let matches = optgroups().parse(&["-Awarnings".to_string()]).unwrap(); let (sess, _) = mk_session(matches); assert!(!sess.diagnostic().can_emit_warnings()); }); - syntax::with_default_globals(|| { + rustc_ast::with_default_globals(|| { let matches = optgroups().parse(&["-Awarnings".to_string(), "-Dwarnings".to_string()]).unwrap(); let (sess, _) = mk_session(matches); assert!(sess.diagnostic().can_emit_warnings()); }); - syntax::with_default_globals(|| { + rustc_ast::with_default_globals(|| { let matches = optgroups().parse(&["-Adead_code".to_string()]).unwrap(); let (sess, _) = mk_session(matches); assert!(sess.diagnostic().can_emit_warnings()); diff --git a/src/librustc_interface/util.rs b/src/librustc_interface/util.rs index b816673a5674e..10a8c0a63f188 100644 --- a/src/librustc_interface/util.rs +++ b/src/librustc_interface/util.rs @@ -1,6 +1,11 @@ use log::info; use rustc::lint; use rustc::ty; +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_codegen_utils::codegen_backend::CodegenBackend; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; @@ -29,11 +34,6 @@ use std::path::{Path, PathBuf}; use std::sync::{Arc, Mutex, Once}; #[cfg(not(parallel_compiler))] use std::{panic, thread}; -use syntax::ast::{AttrVec, BlockCheckMode}; -use syntax::mut_visit::{visit_clobber, MutVisitor, *}; -use syntax::ptr::P; -use syntax::util::lev_distance::find_best_match_for_name; -use syntax::{self, ast}; /// Adds `target_feature = "..."` cfgs for a variety of platform /// specific features (SSE, NEON etc.). @@ -147,7 +147,7 @@ pub fn spawn_thread_pool R + Send, R: Send>( crate::callbacks::setup_callbacks(); scoped_thread(cfg, || { - syntax::with_globals(edition, || { + rustc_ast::with_globals(edition, || { ty::tls::GCX_PTR.set(&Lock::new(0), || { if let Some(stderr) = stderr { io::set_panic(Some(box Sink(stderr.clone()))); @@ -183,15 +183,15 @@ pub fn spawn_thread_pool R + Send, R: Send>( let with_pool = move |pool: &ThreadPool| pool.install(move || f()); - syntax::with_globals(edition, || { - syntax::GLOBALS.with(|syntax_globals| { + rustc_ast::with_globals(edition, || { + rustc_ast::GLOBALS.with(|syntax_globals| { rustc_span::GLOBALS.with(|rustc_span_globals| { // The main handler runs for each Rayon worker thread and sets up // the thread local rustc uses. syntax_globals and rustc_span_globals are // captured and set on the new threads. ty::tls::with_thread_locals sets up - // thread local callbacks from libsyntax + // thread local callbacks from librustc_ast let main_handler = move |thread: ThreadBuilder| { - syntax::GLOBALS.set(syntax_globals, || { + rustc_ast::GLOBALS.set(syntax_globals, || { rustc_span::GLOBALS.set(rustc_span_globals, || { if let Some(stderr) = stderr { io::set_panic(Some(box Sink(stderr.clone()))); diff --git a/src/librustc_lint/Cargo.toml b/src/librustc_lint/Cargo.toml index 1c2c241c000e7..6470d25fe0a2e 100644 --- a/src/librustc_lint/Cargo.toml +++ b/src/librustc_lint/Cargo.toml @@ -17,7 +17,7 @@ rustc_attr = { path = "../librustc_attr" } rustc_errors = { path = "../librustc_errors" } rustc_hir = { path = "../librustc_hir" } rustc_target = { path = "../librustc_target" } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } rustc_span = { path = "../librustc_span" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_feature = { path = "../librustc_feature" } diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 4d03f4579fd2e..96526b3dad3ee 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -25,6 +25,10 @@ use crate::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext} use rustc::hir::map::Map; use rustc::lint::LintDiagnosticBuilder; use rustc::ty::{self, layout::VariantIdx, Ty, TyCtxt}; +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_pretty::pprust::{self, expr_to_string}; use rustc_data_structures::fx::FxHashSet; use rustc_errors::{Applicability, DiagnosticBuilder}; @@ -41,10 +45,6 @@ use rustc_span::edition::Edition; use rustc_span::source_map::Spanned; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::{BytePos, Span}; -use syntax::ast::{self, Expr}; -use syntax::attr::{self, HasAttrs}; -use syntax::tokenstream::{TokenStream, TokenTree}; -use syntax::visit::{FnCtxt, FnKind}; use crate::nonstandard_style::{method_context, MethodLateContext}; @@ -1847,7 +1847,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidValue { /// Test if this constant is all-0. fn is_zero(expr: &hir::Expr<'_>) -> bool { use hir::ExprKind::*; - use syntax::ast::LitKind::*; + use rustc_ast::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 adad1198b096b..29a6b8c693ff3 100644 --- a/src/librustc_lint/context.rs +++ b/src/librustc_lint/context.rs @@ -25,6 +25,8 @@ use rustc::middle::privacy::AccessLevels; use rustc::middle::stability; use rustc::ty::layout::{LayoutError, LayoutOf, TyLayout}; use rustc::ty::{self, print::Printer, subst::GenericArg, Ty, TyCtxt}; +use rustc_ast::ast; +use rustc_ast::util::lev_distance::find_best_match_for_name; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync; use rustc_errors::{struct_span_err, Applicability}; @@ -34,8 +36,6 @@ use rustc_session::lint::BuiltinLintDiagnostics; use rustc_session::lint::{FutureIncompatibleInfo, Level, Lint, LintBuffer, LintId}; use rustc_session::Session; use rustc_span::{symbol::Symbol, MultiSpan, Span, DUMMY_SP}; -use syntax::ast; -use syntax::util::lev_distance::find_best_match_for_name; use std::slice; diff --git a/src/librustc_lint/early.rs b/src/librustc_lint/early.rs index c351159067387..ff6e9e000b097 100644 --- a/src/librustc_lint/early.rs +++ b/src/librustc_lint/early.rs @@ -16,11 +16,11 @@ use crate::context::{EarlyContext, LintContext, LintStore}; use crate::passes::{EarlyLintPass, EarlyLintPassObject}; +use rustc_ast::ast; +use rustc_ast::visit as ast_visit; use rustc_session::lint::{LintBuffer, LintPass}; use rustc_session::Session; use rustc_span::Span; -use syntax::ast; -use syntax::visit as ast_visit; use log::debug; use std::slice; @@ -251,7 +251,7 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T> fn visit_mac(&mut self, mac: &'a ast::Mac) { // FIXME(#54110): So, this setup isn't really right. I think - // that (a) the libsyntax visitor ought to be doing this as + // that (a) the librustc_ast visitor ought to be doing this as // part of `walk_mac`, and (b) we should be calling // `visit_path`, *but* that would require a `NodeId`, and I // want to get #53686 fixed quickly. -nmatsakis diff --git a/src/librustc_lint/internal.rs b/src/librustc_lint/internal.rs index 7875261911201..db109aef6eb8f 100644 --- a/src/librustc_lint/internal.rs +++ b/src/librustc_lint/internal.rs @@ -2,13 +2,13 @@ //! Clippy. use crate::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext}; +use rustc_ast::ast::{Ident, Item, ItemKind}; use rustc_data_structures::fx::FxHashMap; use rustc_errors::Applicability; use rustc_hir::{GenericArg, HirId, MutTy, Mutability, Path, PathSegment, QPath, Ty, TyKind}; use rustc_session::{declare_lint_pass, declare_tool_lint, impl_lint_pass}; use rustc_span::hygiene::{ExpnKind, MacroKind}; use rustc_span::symbol::{sym, Symbol}; -use syntax::ast::{Ident, Item, ItemKind}; declare_tool_lint! { pub rustc::DEFAULT_HASH_TYPES, diff --git a/src/librustc_lint/late.rs b/src/librustc_lint/late.rs index b3d5cdf15c933..ee03232a0ce4c 100644 --- a/src/librustc_lint/late.rs +++ b/src/librustc_lint/late.rs @@ -17,6 +17,8 @@ use crate::{passes::LateLintPassObject, LateContext, LateLintPass, LintStore}; use rustc::hir::map::Map; use rustc::ty::{self, TyCtxt}; +use rustc_ast::ast; +use rustc_ast::walk_list; use rustc_data_structures::sync::{join, par_iter, ParallelIterator}; use rustc_hir as hir; use rustc_hir::def_id::{DefId, LOCAL_CRATE}; @@ -24,8 +26,6 @@ use rustc_hir::intravisit as hir_visit; use rustc_hir::intravisit::Visitor; use rustc_session::lint::LintPass; use rustc_span::Span; -use syntax::ast; -use syntax::walk_list; use log::debug; use std::any::Any; diff --git a/src/librustc_lint/levels.rs b/src/librustc_lint/levels.rs index 8e1947e52ca32..7da69f3ed26f2 100644 --- a/src/librustc_lint/levels.rs +++ b/src/librustc_lint/levels.rs @@ -5,6 +5,9 @@ use rustc::lint::LintDiagnosticBuilder; use rustc::lint::{struct_lint_level, LintLevelMap, LintLevelSets, LintSet, LintSource}; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_ast::ast; +use rustc_ast::attr; +use rustc_ast::unwrap_or; use rustc_ast_pretty::pprust; use rustc_data_structures::fx::FxHashMap; use rustc_errors::{struct_span_err, Applicability}; @@ -16,9 +19,6 @@ use rustc_session::parse::feature_err; use rustc_session::Session; use rustc_span::source_map::MultiSpan; use rustc_span::symbol::{sym, Symbol}; -use syntax::ast; -use syntax::attr; -use syntax::unwrap_or; use std::cmp; diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 7b42cd0e4a222..895c42a84d8e9 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -55,6 +55,7 @@ mod unused; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_ast::ast; use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_session::lint::builtin::{ @@ -62,7 +63,6 @@ use rustc_session::lint::builtin::{ INTRA_DOC_LINK_RESOLUTION_FAILURE, MISSING_DOC_CODE_EXAMPLES, PRIVATE_DOC_TESTS, }; use rustc_span::Span; -use syntax::ast; use array_into_iter::ArrayIntoIter; use builtin::*; diff --git a/src/librustc_lint/non_ascii_idents.rs b/src/librustc_lint/non_ascii_idents.rs index a0ca7ad1860e8..470fac2675bac 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 syntax::ast; +use rustc_ast::ast; declare_lint! { pub NON_ASCII_IDENTS, diff --git a/src/librustc_lint/nonstandard_style.rs b/src/librustc_lint/nonstandard_style.rs index 8c58f2ba4c07a..b0560dc9fdf9c 100644 --- a/src/librustc_lint/nonstandard_style.rs +++ b/src/librustc_lint/nonstandard_style.rs @@ -1,5 +1,6 @@ use crate::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext}; use rustc::ty; +use rustc_ast::ast; use rustc_attr as attr; use rustc_errors::Applicability; use rustc_hir as hir; @@ -9,7 +10,6 @@ use rustc_hir::{GenericParamKind, PatKind}; use rustc_span::symbol::sym; use rustc_span::{symbol::Ident, BytePos, Span}; use rustc_target::spec::abi::Abi; -use syntax::ast; #[derive(PartialEq)] pub enum MethodLateContext { diff --git a/src/librustc_lint/passes.rs b/src/librustc_lint/passes.rs index 36de625cafac2..813be2a032f8b 100644 --- a/src/librustc_lint/passes.rs +++ b/src/librustc_lint/passes.rs @@ -1,11 +1,11 @@ use crate::context::{EarlyContext, LateContext}; +use rustc_ast::ast; use rustc_data_structures::sync; use rustc_hir as hir; use rustc_session::lint::builtin::HardwiredLints; use rustc_session::lint::LintPass; use rustc_span::Span; -use syntax::ast; #[macro_export] macro_rules! late_lint_methods { @@ -179,9 +179,9 @@ macro_rules! early_lint_methods { fn check_where_predicate(a: &ast::WherePredicate); fn check_poly_trait_ref(a: &ast::PolyTraitRef, b: &ast::TraitBoundModifier); - fn check_fn(a: syntax::visit::FnKind<'_>, c: Span, d_: ast::NodeId); + fn check_fn(a: rustc_ast::visit::FnKind<'_>, c: Span, d_: ast::NodeId); fn check_fn_post( - a: syntax::visit::FnKind<'_>, + a: rustc_ast::visit::FnKind<'_>, c: Span, d: ast::NodeId ); diff --git a/src/librustc_lint/redundant_semicolon.rs b/src/librustc_lint/redundant_semicolon.rs index 68cb0b54f56c5..0b66fd92430ac 100644 --- a/src/librustc_lint/redundant_semicolon.rs +++ b/src/librustc_lint/redundant_semicolon.rs @@ -1,6 +1,6 @@ use crate::{EarlyContext, EarlyLintPass, LintContext}; +use rustc_ast::ast::{ExprKind, Stmt, StmtKind}; use rustc_errors::Applicability; -use syntax::ast::{ExprKind, Stmt, StmtKind}; declare_lint! { pub REDUNDANT_SEMICOLON, diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 6901a66b1ce5c..86d93612e993b 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -5,6 +5,7 @@ use rustc::mir::interpret::{sign_extend, truncate}; use rustc::ty::layout::{self, IntegerExt, LayoutOf, SizeSkeleton, VariantIdx}; use rustc::ty::subst::SubstsRef; use rustc::ty::{self, AdtKind, ParamEnv, Ty, TyCtxt}; +use rustc_ast::ast; use rustc_attr as attr; use rustc_data_structures::fx::FxHashSet; use rustc_errors::Applicability; @@ -16,7 +17,6 @@ use rustc_span::source_map; use rustc_span::symbol::sym; use rustc_span::Span; use rustc_target::spec::abi::Abi; -use syntax::ast; use log::debug; use std::cmp; @@ -194,8 +194,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 syntax::ast::IntTy::*; - use syntax::ast::UintTy::*; + use rustc_ast::ast::IntTy::*; + use rustc_ast::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 7870b9da4cb70..7b6741954d9c8 100644 --- a/src/librustc_lint/unused.rs +++ b/src/librustc_lint/unused.rs @@ -1,6 +1,9 @@ use crate::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext}; use rustc::ty::adjustment; use rustc::ty::{self, Ty}; +use rustc_ast::ast; +use rustc_ast::attr; +use rustc_ast::util::parser; use rustc_ast_pretty::pprust; use rustc_data_structures::fx::FxHashMap; use rustc_errors::{pluralize, Applicability}; @@ -12,9 +15,6 @@ use rustc_session::lint::builtin::UNUSED_ATTRIBUTES; use rustc_span::symbol::Symbol; use rustc_span::symbol::{kw, sym}; use rustc_span::{BytePos, Span}; -use syntax::ast; -use syntax::attr; -use syntax::util::parser; use log::debug; @@ -469,7 +469,7 @@ impl UnusedParens { impl EarlyLintPass for UnusedParens { fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) { - use syntax::ast::ExprKind::*; + use rustc_ast::ast::ExprKind::*; let (value, msg, followed_by_block, left_pos, right_pos) = match e.kind { Let(ref pat, ..) => { self.check_unused_parens_pat(cx, pat, false, false); diff --git a/src/librustc_metadata/Cargo.toml b/src/librustc_metadata/Cargo.toml index a4fdcee5e1297..8abfb20965e48 100644 --- a/src/librustc_metadata/Cargo.toml +++ b/src/librustc_metadata/Cargo.toml @@ -24,7 +24,7 @@ rustc_target = { path = "../librustc_target" } rustc_index = { path = "../librustc_index" } rustc_serialize = { path = "../libserialize", package = "serialize" } stable_deref_trait = "1.0.0" -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } rustc_expand = { path = "../librustc_expand" } rustc_parse = { path = "../librustc_parse" } rustc_span = { path = "../librustc_span" } diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs index 647224bc8d6b7..293a353a092d0 100644 --- a/src/librustc_metadata/creader.rs +++ b/src/librustc_metadata/creader.rs @@ -10,6 +10,9 @@ use rustc::session::config; use rustc::session::search_paths::PathKind; use rustc::session::{CrateDisambiguator, Session}; use rustc::ty::TyCtxt; +use rustc_ast::ast; +use rustc_ast::attr; +use rustc_ast::expand::allocator::{global_allocator_spans, AllocatorKind}; use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::Lrc; use rustc_errors::struct_span_err; @@ -20,9 +23,6 @@ use rustc_span::edition::Edition; use rustc_span::symbol::{sym, Symbol}; use rustc_span::{Span, DUMMY_SP}; use rustc_target::spec::{PanicStrategy, TargetTriple}; -use syntax::ast; -use syntax::attr; -use syntax::expand::allocator::{global_allocator_spans, AllocatorKind}; use log::{debug, info, log_enabled}; use proc_macro::bridge::client::ProcMacro; diff --git a/src/librustc_metadata/rmeta/decoder.rs b/src/librustc_metadata/rmeta/decoder.rs index ee68697d260b3..a72ee0cbe4729 100644 --- a/src/librustc_metadata/rmeta/decoder.rs +++ b/src/librustc_metadata/rmeta/decoder.rs @@ -34,6 +34,7 @@ use std::u32; use log::debug; use proc_macro::bridge::client::ProcMacro; +use rustc_ast::ast::{self, Ident}; use rustc_attr as attr; use rustc_expand::base::{SyntaxExtension, SyntaxExtensionKind}; use rustc_expand::proc_macro::{AttrProcMacro, BangProcMacro, ProcMacroDerive}; @@ -41,7 +42,6 @@ use rustc_serialize::{opaque, Decodable, Decoder, SpecializedDecoder}; use rustc_span::source_map::{self, respan, Spanned}; use rustc_span::symbol::{sym, Symbol}; use rustc_span::{self, hygiene::MacroKind, BytePos, Pos, Span, DUMMY_SP}; -use syntax::ast::{self, Ident}; pub use cstore_impl::{provide, provide_extern}; @@ -1616,7 +1616,7 @@ impl<'a, 'tcx> CrateMetadata { } // Cannot be implemented on 'ProcMacro', as libproc_macro -// does not depend on libsyntax +// does not depend on librustc_ast fn macro_kind(raw: &ProcMacro) -> MacroKind { match raw { ProcMacro::CustomDerive { .. } => MacroKind::Derive, diff --git a/src/librustc_metadata/rmeta/decoder/cstore_impl.rs b/src/librustc_metadata/rmeta/decoder/cstore_impl.rs index e6270e903295c..50ab3811f5236 100644 --- a/src/librustc_metadata/rmeta/decoder/cstore_impl.rs +++ b/src/librustc_metadata/rmeta/decoder/cstore_impl.rs @@ -25,15 +25,15 @@ use smallvec::SmallVec; use std::any::Any; use std::sync::Arc; +use rustc_ast::ast; +use rustc_ast::attr; +use rustc_ast::expand::allocator::AllocatorKind; +use rustc_ast::ptr::P; +use rustc_ast::tokenstream::DelimSpan; use rustc_span::source_map; use rustc_span::source_map::Spanned; use rustc_span::symbol::Symbol; use rustc_span::{FileName, Span}; -use syntax::ast; -use syntax::attr; -use syntax::expand::allocator::AllocatorKind; -use syntax::ptr::P; -use syntax::tokenstream::DelimSpan; macro_rules! provide { (<$lt:tt> $tcx:ident, $def_id:ident, $other:ident, $cdata:ident, diff --git a/src/librustc_metadata/rmeta/encoder.rs b/src/librustc_metadata/rmeta/encoder.rs index ee54f40ece5c8..418b97b74c805 100644 --- a/src/librustc_metadata/rmeta/encoder.rs +++ b/src/librustc_metadata/rmeta/encoder.rs @@ -25,6 +25,8 @@ use rustc_data_structures::sync::Lrc; use rustc_serialize::{opaque, Encodable, Encoder, SpecializedEncoder}; use log::{debug, trace}; +use rustc_ast::ast; +use rustc_ast::attr; use rustc_span::source_map::Spanned; use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::{self, FileName, SourceFile, Span}; @@ -32,8 +34,6 @@ use std::hash::Hash; use std::num::NonZeroUsize; use std::path::Path; use std::u32; -use syntax::ast; -use syntax::attr; use rustc_hir as hir; use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor}; diff --git a/src/librustc_metadata/rmeta/mod.rs b/src/librustc_metadata/rmeta/mod.rs index 01a3f6c560f1b..9b05fd4734ca3 100644 --- a/src/librustc_metadata/rmeta/mod.rs +++ b/src/librustc_metadata/rmeta/mod.rs @@ -10,6 +10,7 @@ use rustc::mir; use rustc::session::config::SymbolManglingVersion; use rustc::session::CrateDisambiguator; use rustc::ty::{self, ReprOptions, Ty}; +use rustc_ast::ast; use rustc_attr as attr; use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::MetadataRef; @@ -22,7 +23,6 @@ use rustc_span::edition::Edition; use rustc_span::symbol::Symbol; use rustc_span::{self, Span}; use rustc_target::spec::{PanicStrategy, TargetTriple}; -use syntax::ast; use std::marker::PhantomData; use std::num::NonZeroUsize; diff --git a/src/librustc_mir/Cargo.toml b/src/librustc_mir/Cargo.toml index 3554fe54c4597..6e606230b6371 100644 --- a/src/librustc_mir/Cargo.toml +++ b/src/librustc_mir/Cargo.toml @@ -28,7 +28,7 @@ rustc_lexer = { path = "../librustc_lexer" } rustc_macros = { path = "../librustc_macros" } rustc_serialize = { path = "../libserialize", package = "serialize" } rustc_target = { path = "../librustc_target" } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } rustc_span = { path = "../librustc_span" } rustc_apfloat = { path = "../librustc_apfloat" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index aa49ab1b722d1..28974dcd08bf6 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -28,8 +28,8 @@ use std::collections::BTreeMap; use std::mem; use std::rc::Rc; +use rustc_ast::ast::Name; use rustc_span::{Span, DUMMY_SP}; -use syntax::ast::Name; use crate::dataflow; use crate::dataflow::generic::{Analysis, BorrowckFlowState as Flows, BorrowckResults}; diff --git a/src/librustc_mir/dataflow/generic/engine.rs b/src/librustc_mir/dataflow/generic/engine.rs index 371bfa9a6fdb4..3373151f82cc8 100644 --- a/src/librustc_mir/dataflow/generic/engine.rs +++ b/src/librustc_mir/dataflow/generic/engine.rs @@ -6,12 +6,12 @@ use std::path::PathBuf; use rustc::mir::{self, traversal, BasicBlock, Location}; use rustc::ty::{self, TyCtxt}; +use rustc_ast::ast; use rustc_data_structures::work_queue::WorkQueue; use rustc_hir::def_id::DefId; use rustc_index::bit_set::BitSet; use rustc_index::vec::IndexVec; use rustc_span::symbol::{sym, Symbol}; -use syntax::ast; use super::graphviz; use super::{Analysis, GenKillAnalysis, GenKillSet, Results}; diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs index a0d93d6d19ab8..4d86ed9cab25c 100644 --- a/src/librustc_mir/dataflow/mod.rs +++ b/src/librustc_mir/dataflow/mod.rs @@ -1,6 +1,6 @@ +use rustc_ast::ast::{self, MetaItem}; use rustc_ast_pretty::pprust; use rustc_span::symbol::{sym, Symbol}; -use syntax::ast::{self, MetaItem}; use rustc_data_structures::work_queue::WorkQueue; use rustc_index::bit_set::{BitSet, HybridBitSet}; diff --git a/src/librustc_mir/interpret/cast.rs b/src/librustc_mir/interpret/cast.rs index 9461a06690212..1a0be582ce67f 100644 --- a/src/librustc_mir/interpret/cast.rs +++ b/src/librustc_mir/interpret/cast.rs @@ -1,8 +1,8 @@ use rustc::ty::adjustment::PointerCast; use rustc::ty::layout::{self, Size, TyLayout}; use rustc::ty::{self, Ty, TypeAndMut, TypeFoldable}; +use rustc_ast::ast::FloatTy; use rustc_span::symbol::sym; -use syntax::ast::FloatTy; use rustc::mir::interpret::{InterpResult, PointerArithmetic, Scalar}; use rustc::mir::CastKind; diff --git a/src/librustc_mir/interpret/intern.rs b/src/librustc_mir/interpret/intern.rs index 9fea82d78c94f..747b2dd4aa007 100644 --- a/src/librustc_mir/interpret/intern.rs +++ b/src/librustc_mir/interpret/intern.rs @@ -9,7 +9,7 @@ use rustc::ty::{self, Ty}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir as hir; -use syntax::ast::Mutability; +use rustc_ast::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 1df389d9c8bee..032a4bd58506d 100644 --- a/src/librustc_mir/interpret/memory.rs +++ b/src/librustc_mir/interpret/memory.rs @@ -14,7 +14,7 @@ use rustc::ty::layout::{Align, HasDataLayout, Size, TargetDataLayout}; use rustc::ty::{self, query::TyCtxtAt, Instance, ParamEnv}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; -use syntax::ast::Mutability; +use rustc_ast::ast::Mutability; use super::{ AllocId, AllocMap, Allocation, AllocationExtra, CheckInAllocMsg, ErrorHandled, GlobalAlloc, diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs index 14b8a341e26a0..ed2d2243ab41b 100644 --- a/src/librustc_mir/interpret/operand.rs +++ b/src/librustc_mir/interpret/operand.rs @@ -13,8 +13,8 @@ pub use rustc::mir::interpret::ScalarMaybeUndef; use rustc::mir::interpret::{ sign_extend, truncate, AllocId, ConstValue, GlobalId, InterpResult, Pointer, Scalar, }; +use rustc_ast::ast; use rustc_macros::HashStable; -use syntax::ast; /// An `Immediate` represents a single immediate self-contained Rust value. /// diff --git a/src/librustc_mir/interpret/operator.rs b/src/librustc_mir/interpret/operator.rs index 2e8c94903ca46..cd7a419af9508 100644 --- a/src/librustc_mir/interpret/operator.rs +++ b/src/librustc_mir/interpret/operator.rs @@ -6,7 +6,7 @@ use rustc::ty::{ Ty, }; use rustc_apfloat::Float; -use syntax::ast::FloatTy; +use rustc_ast::ast::FloatTy; use super::{ImmTy, Immediate, InterpCx, Machine, PlaceTy}; diff --git a/src/librustc_mir/interpret/snapshot.rs b/src/librustc_mir/interpret/snapshot.rs index a8e67c8f208a9..2353b74016c2b 100644 --- a/src/librustc_mir/interpret/snapshot.rs +++ b/src/librustc_mir/interpret/snapshot.rs @@ -15,12 +15,12 @@ use rustc::mir::interpret::{ use rustc::ty::layout::{Align, Size}; use rustc::ty::{self, TyCtxt}; +use rustc_ast::ast::Mutability; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_index::vec::IndexVec; use rustc_macros::HashStable; use rustc_span::source_map::Span; -use syntax::ast::Mutability; use super::eval_context::{LocalState, StackPopCleanup}; use super::{ diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 9e05133132e05..654130c6fab9b 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -20,6 +20,7 @@ use rustc::ty::layout::{ }; use rustc::ty::subst::{InternalSubsts, Subst}; use rustc::ty::{self, ConstKind, Instance, ParamEnv, Ty, TyCtxt, TypeFoldable}; +use rustc_ast::ast::Mutability; use rustc_data_structures::fx::FxHashMap; use rustc_hir::def::DefKind; use rustc_hir::def_id::DefId; @@ -27,7 +28,6 @@ use rustc_hir::HirId; use rustc_index::vec::IndexVec; use rustc_infer::traits; use rustc_span::Span; -use syntax::ast::Mutability; use crate::const_eval::error_to_const_error; use crate::interpret::{ diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index c534c2f3bb84c..57e002bf3f3d6 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -4,13 +4,13 @@ use rustc::mir::{BodyAndCache, ConstQualifs, MirPhase, Promoted}; use rustc::ty::query::Providers; use rustc::ty::steal::Steal; use rustc::ty::{InstanceDef, TyCtxt, TypeFoldable}; +use rustc_ast::ast; use rustc_hir as hir; use rustc_hir::def_id::{CrateNum, DefId, DefIdSet, LOCAL_CRATE}; use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc_index::vec::IndexVec; use rustc_span::Span; use std::borrow::Cow; -use syntax::ast; pub mod add_call_guards; pub mod add_moves_for_packed_drops; diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index a5d59860c3d16..286740f99dde6 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -18,10 +18,10 @@ use rustc::mir::*; use rustc::ty::cast::CastTy; use rustc::ty::subst::InternalSubsts; use rustc::ty::{self, List, TyCtxt, TypeFoldable}; +use rustc_ast::ast::LitKind; use rustc_hir::def_id::DefId; use rustc_span::symbol::sym; use rustc_span::{Span, DUMMY_SP}; -use syntax::ast::LitKind; use rustc_index::vec::{Idx, IndexVec}; use rustc_target::spec::abi::Abi; diff --git a/src/librustc_mir/transform/rustc_peek.rs b/src/librustc_mir/transform/rustc_peek.rs index 6176cf8bc0fa6..2ae7bd4d72729 100644 --- a/src/librustc_mir/transform/rustc_peek.rs +++ b/src/librustc_mir/transform/rustc_peek.rs @@ -1,7 +1,7 @@ +use rustc_ast::ast; use rustc_span::symbol::sym; use rustc_span::Span; use rustc_target::spec::abi::Abi; -use syntax::ast; use crate::transform::{MirPass, MirSource}; use rustc::mir::{self, Body, BodyAndCache, Local, Location}; diff --git a/src/librustc_mir_build/Cargo.toml b/src/librustc_mir_build/Cargo.toml index fac30637dd077..d53188a39e5e0 100644 --- a/src/librustc_mir_build/Cargo.toml +++ b/src/librustc_mir_build/Cargo.toml @@ -25,5 +25,5 @@ rustc_serialize = { path = "../libserialize", package = "serialize" } rustc_session = { path = "../librustc_session" } rustc_span = { path = "../librustc_span" } rustc_target = { path = "../librustc_target" } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } diff --git a/src/librustc_mir_build/build/matches/mod.rs b/src/librustc_mir_build/build/matches/mod.rs index bb61e56a2c51d..e7c7e2b47f28f 100644 --- a/src/librustc_mir_build/build/matches/mod.rs +++ b/src/librustc_mir_build/build/matches/mod.rs @@ -19,7 +19,7 @@ use rustc_hir::HirId; use rustc_index::bit_set::BitSet; use rustc_span::Span; use smallvec::{smallvec, SmallVec}; -use syntax::ast::Name; +use rustc_ast::ast::Name; // helper functions, broken out by category: mod simplify; diff --git a/src/librustc_mir_build/hair/constant.rs b/src/librustc_mir_build/hair/constant.rs index e9dd78542753f..d5e5398b9d41e 100644 --- a/src/librustc_mir_build/hair/constant.rs +++ b/src/librustc_mir_build/hair/constant.rs @@ -2,8 +2,8 @@ use rustc::mir::interpret::{ truncate, Allocation, ConstValue, LitToConstError, LitToConstInput, Scalar, }; use rustc::ty::{self, layout::Size, ParamEnv, TyCtxt, TyS}; +use rustc_ast::ast; use rustc_span::symbol::Symbol; -use syntax::ast; crate fn lit_to_const<'tcx>( tcx: TyCtxt<'tcx>, diff --git a/src/librustc_mir_build/hair/cx/mod.rs b/src/librustc_mir_build/hair/cx/mod.rs index f4860733db835..449e2e7494697 100644 --- a/src/librustc_mir_build/hair/cx/mod.rs +++ b/src/librustc_mir_build/hair/cx/mod.rs @@ -11,14 +11,14 @@ use rustc::ty::layout::VariantIdx; use rustc::ty::subst::Subst; use rustc::ty::subst::{GenericArg, InternalSubsts}; use rustc::ty::{self, Ty, TyCtxt}; +use rustc_ast::ast; +use rustc_ast::attr; use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_hir::Node; use rustc_index::vec::Idx; use rustc_infer::infer::InferCtxt; use rustc_span::symbol::{sym, Symbol}; -use syntax::ast; -use syntax::attr; #[derive(Clone)] crate struct Cx<'a, 'tcx> { diff --git a/src/librustc_mir_build/hair/pattern/check_match.rs b/src/librustc_mir_build/hair/pattern/check_match.rs index 3dfe826ad2abb..edd05ee0aa94e 100644 --- a/src/librustc_mir_build/hair/pattern/check_match.rs +++ b/src/librustc_mir_build/hair/pattern/check_match.rs @@ -6,6 +6,7 @@ use super::{PatCtxt, PatKind, PatternError}; use rustc::hir::map::Map; use rustc::ty::{self, Ty, TyCtxt}; +use rustc_ast::ast::Mutability; use rustc_errors::{error_code, struct_span_err, Applicability, DiagnosticBuilder}; use rustc_hir as hir; use rustc_hir::def::*; @@ -17,7 +18,6 @@ use rustc_session::lint::builtin::{IRREFUTABLE_LET_PATTERNS, UNREACHABLE_PATTERN use rustc_session::parse::feature_err; use rustc_session::Session; use rustc_span::{sym, Span}; -use syntax::ast::Mutability; use std::slice; diff --git a/src/librustc_mir_build/hair/pattern/mod.rs b/src/librustc_mir_build/hair/pattern/mod.rs index 6979a98e68736..f58216fbb4e76 100644 --- a/src/librustc_mir_build/hair/pattern/mod.rs +++ b/src/librustc_mir_build/hair/pattern/mod.rs @@ -16,6 +16,7 @@ use rustc::ty::layout::VariantIdx; use rustc::ty::subst::{GenericArg, SubstsRef}; use rustc::ty::{self, AdtDef, DefIdTree, Region, Ty, TyCtxt, UserType}; use rustc::ty::{CanonicalUserType, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations}; +use rustc_ast::ast; use rustc_errors::struct_span_err; use rustc_hir as hir; use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res}; @@ -23,7 +24,6 @@ use rustc_hir::pat_util::EnumerateAndAdjustIterator; use rustc_hir::RangeEnd; use rustc_index::vec::Idx; use rustc_span::{Span, DUMMY_SP}; -use syntax::ast; use std::cmp::Ordering; use std::fmt; diff --git a/src/librustc_parse/Cargo.toml b/src/librustc_parse/Cargo.toml index 176bb58ad27e6..b02cabab0a8fc 100644 --- a/src/librustc_parse/Cargo.toml +++ b/src/librustc_parse/Cargo.toml @@ -21,5 +21,5 @@ rustc_errors = { path = "../librustc_errors" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } rustc_session = { path = "../librustc_session" } rustc_span = { path = "../librustc_span" } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } unicode-normalization = "0.1.11" diff --git a/src/librustc_parse/config.rs b/src/librustc_parse/config.rs index ec0d251a3f8df..17b9e78e5df46 100644 --- a/src/librustc_parse/config.rs +++ b/src/librustc_parse/config.rs @@ -9,6 +9,11 @@ //! [#64197]: https://github.com/rust-lang/rust/issues/64197 use crate::{parse_in, validate_attr}; +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::util::map_in_place::MapInPlace; use rustc_attr as attr; use rustc_data_structures::fx::FxHashMap; use rustc_errors::{error_code, struct_span_err, Applicability, Handler}; @@ -20,11 +25,6 @@ use rustc_session::parse::{feature_err, ParseSess}; use rustc_span::edition::{Edition, ALL_EDITIONS}; use rustc_span::symbol::{sym, Symbol}; use rustc_span::{Span, DUMMY_SP}; -use syntax::ast::{self, AttrItem, Attribute, MetaItem}; -use syntax::attr::HasAttrs; -use syntax::mut_visit::*; -use syntax::ptr::P; -use syntax::util::map_in_place::MapInPlace; use smallvec::SmallVec; diff --git a/src/librustc_parse/lexer/mod.rs b/src/librustc_parse/lexer/mod.rs index face0e679927c..f7fb704fcbc2c 100644 --- a/src/librustc_parse/lexer/mod.rs +++ b/src/librustc_parse/lexer/mod.rs @@ -1,3 +1,5 @@ +use rustc_ast::token::{self, Token, TokenKind}; +use rustc_ast::util::comments; use rustc_data_structures::sync::Lrc; use rustc_errors::{error_code, DiagnosticBuilder, FatalError}; use rustc_lexer::unescape; @@ -5,8 +7,6 @@ use rustc_lexer::Base; use rustc_session::parse::ParseSess; use rustc_span::symbol::{sym, Symbol}; use rustc_span::{BytePos, Pos, Span}; -use syntax::token::{self, Token, TokenKind}; -use syntax::util::comments; use log::debug; use std::char; @@ -172,7 +172,7 @@ impl<'a> StringReader<'a> { } /// Turns simple `rustc_lexer::TokenKind` enum into a rich - /// `libsyntax::TokenKind`. This turns strings into interned + /// `librustc_ast::TokenKind`. This turns strings into interned /// symbols and runs additional validation. fn cook_lexer_token(&self, token: rustc_lexer::TokenKind, start: BytePos) -> TokenKind { match token { diff --git a/src/librustc_parse/lexer/tokentrees.rs b/src/librustc_parse/lexer/tokentrees.rs index e87dde8863cc8..6c0acd0302fb1 100644 --- a/src/librustc_parse/lexer/tokentrees.rs +++ b/src/librustc_parse/lexer/tokentrees.rs @@ -1,15 +1,15 @@ use super::{StringReader, UnmatchedBrace}; -use rustc_ast_pretty::pprust::token_to_string; -use rustc_data_structures::fx::FxHashMap; -use rustc_errors::PResult; -use rustc_span::Span; -use syntax::token::{self, Token}; -use syntax::tokenstream::{ +use rustc_ast::token::{self, Token}; +use rustc_ast::tokenstream::{ DelimSpan, IsJoint::{self, *}, TokenStream, TokenTree, TreeAndJoint, }; +use rustc_ast_pretty::pprust::token_to_string; +use rustc_data_structures::fx::FxHashMap; +use rustc_errors::PResult; +use rustc_span::Span; impl<'a> StringReader<'a> { crate fn into_token_trees(self) -> (PResult<'a, TokenStream>, Vec) { diff --git a/src/librustc_parse/lib.rs b/src/librustc_parse/lib.rs index c60330864defd..25f9f8fd3ad4f 100644 --- a/src/librustc_parse/lib.rs +++ b/src/librustc_parse/lib.rs @@ -3,14 +3,14 @@ #![feature(bool_to_option)] #![feature(crate_visibility_modifier)] +use rustc_ast::ast; +use rustc_ast::token::{self, Nonterminal, Token}; +use rustc_ast::tokenstream::{self, TokenStream, TokenTree}; use rustc_ast_pretty::pprust; use rustc_data_structures::sync::Lrc; use rustc_errors::{Diagnostic, FatalError, Level, PResult}; use rustc_session::parse::ParseSess; use rustc_span::{FileName, SourceFile, Span}; -use syntax::ast; -use syntax::token::{self, Nonterminal, Token}; -use syntax::tokenstream::{self, TokenStream, TokenTree}; use std::path::{Path, PathBuf}; use std::str; @@ -269,7 +269,7 @@ pub fn stream_to_parser<'a>( /// # Note /// /// The main usage of this function is outside of rustc, for those who uses -/// libsyntax as a library. Please do not remove this function while refactoring +/// librustc_ast as a library. Please do not remove this function while refactoring /// just because it is not used in rustc codebase! pub fn stream_to_parser_with_base_dir<'a>( sess: &'a ParseSess, diff --git a/src/librustc_parse/parser/attr.rs b/src/librustc_parse/parser/attr.rs index 905f6bef58e85..93de5a33fe344 100644 --- a/src/librustc_parse/parser/attr.rs +++ b/src/librustc_parse/parser/attr.rs @@ -1,11 +1,11 @@ use super::{Parser, PathStyle, TokenType}; +use rustc_ast::ast; +use rustc_ast::attr; +use rustc_ast::token::{self, Nonterminal}; +use rustc_ast::util::comments; use rustc_ast_pretty::pprust; use rustc_errors::PResult; use rustc_span::{Span, Symbol}; -use syntax::ast; -use syntax::attr; -use syntax::token::{self, Nonterminal}; -use syntax::util::comments; use log::debug; diff --git a/src/librustc_parse/parser/diagnostics.rs b/src/librustc_parse/parser/diagnostics.rs index 00f5fb9705286..c27b429563aca 100644 --- a/src/librustc_parse/parser/diagnostics.rs +++ b/src/librustc_parse/parser/diagnostics.rs @@ -1,6 +1,13 @@ use super::ty::AllowPlus; use super::{BlockMode, Parser, PathStyle, SemiColonMode, SeqSep, TokenExpectType, TokenType}; +use rustc_ast::ast::{ + self, BinOpKind, BindingMode, BlockCheckMode, Expr, ExprKind, Ident, Item, Param, +}; +use rustc_ast::ast::{AttrVec, ItemKind, Mutability, Pat, PatKind, PathSegment, QSelf, Ty, TyKind}; +use rustc_ast::ptr::P; +use rustc_ast::token::{self, TokenKind}; +use rustc_ast::util::parser::AssocOp; use rustc_ast_pretty::pprust; use rustc_data_structures::fx::FxHashSet; use rustc_errors::{pluralize, struct_span_err}; @@ -8,13 +15,6 @@ use rustc_errors::{Applicability, DiagnosticBuilder, Handler, PResult}; use rustc_span::source_map::Spanned; use rustc_span::symbol::kw; use rustc_span::{MultiSpan, Span, SpanSnippetError, DUMMY_SP}; -use syntax::ast::{ - self, BinOpKind, BindingMode, BlockCheckMode, Expr, ExprKind, Ident, Item, Param, -}; -use syntax::ast::{AttrVec, ItemKind, Mutability, Pat, PatKind, PathSegment, QSelf, Ty, TyKind}; -use syntax::ptr::P; -use syntax::token::{self, TokenKind}; -use syntax::util::parser::AssocOp; use log::{debug, trace}; use std::mem; diff --git a/src/librustc_parse/parser/expr.rs b/src/librustc_parse/parser/expr.rs index 71ca8fba0b479..703fbbb6a6ea3 100644 --- a/src/librustc_parse/parser/expr.rs +++ b/src/librustc_parse/parser/expr.rs @@ -4,19 +4,19 @@ 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, Ident, Lit, DUMMY_NODE_ID}; +use rustc_ast::ast::{AnonConst, BinOp, BinOpKind, FnDecl, FnRetTy, Mac, Param, Ty, TyKind, UnOp}; +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_pretty::pprust; use rustc_errors::{Applicability, PResult}; use rustc_span::source_map::{self, Span, Spanned}; use rustc_span::symbol::{kw, sym, Symbol}; use std::mem; -use syntax::ast::{self, AttrStyle, AttrVec, CaptureBy, Field, Ident, Lit, DUMMY_NODE_ID}; -use syntax::ast::{AnonConst, BinOp, BinOpKind, FnDecl, FnRetTy, Mac, Param, Ty, TyKind, UnOp}; -use syntax::ast::{Arm, Async, BlockCheckMode, Expr, ExprKind, Label, Movability, RangeLimits}; -use syntax::ptr::P; -use syntax::token::{self, Token, TokenKind}; -use syntax::util::classify; -use syntax::util::literal::LitError; -use syntax::util::parser::{prec_let_scrutinee_needs_par, AssocOp, Fixity}; /// Possibly accepts an `token::Interpolated` expression (a pre-parsed expression /// dropped into the token stream, which happens while parsing the result of diff --git a/src/librustc_parse/parser/generics.rs b/src/librustc_parse/parser/generics.rs index d5ad1e90d16f4..481dde0a35c57 100644 --- a/src/librustc_parse/parser/generics.rs +++ b/src/librustc_parse/parser/generics.rs @@ -1,9 +1,9 @@ use super::Parser; +use rustc_ast::ast::{self, Attribute, GenericBounds, GenericParam, GenericParamKind, WhereClause}; +use rustc_ast::token; use rustc_errors::PResult; use rustc_span::symbol::{kw, sym}; -use syntax::ast::{self, Attribute, GenericBounds, GenericParam, GenericParamKind, WhereClause}; -use syntax::token; impl<'a> Parser<'a> { /// Parses bounds of a lifetime parameter `BOUND + BOUND + BOUND`, possibly with trailing `+`. diff --git a/src/librustc_parse/parser/item.rs b/src/librustc_parse/parser/item.rs index ef4246609da9a..692ea0cf5bf23 100644 --- a/src/librustc_parse/parser/item.rs +++ b/src/librustc_parse/parser/item.rs @@ -4,19 +4,23 @@ use super::{FollowedByType, Parser, PathStyle}; use crate::maybe_whole; +use rustc_ast::ast::{self, AttrStyle, AttrVec, Attribute, Ident, DUMMY_NODE_ID}; +use rustc_ast::ast::{AssocItem, AssocItemKind, ForeignItemKind, Item, ItemKind}; +use rustc_ast::ast::{ + Async, Const, Defaultness, IsAuto, PathSegment, Unsafe, UseTree, UseTreeKind, +}; +use rustc_ast::ast::{ + BindingMode, Block, FnDecl, FnSig, Mac, MacArgs, MacDelimiter, Param, SelfKind, +}; +use rustc_ast::ast::{EnumDef, Generics, StructField, TraitRef, Ty, TyKind, Variant, VariantData}; +use rustc_ast::ast::{FnHeader, ForeignItem, Mutability, Visibility, VisibilityKind}; +use rustc_ast::ptr::P; +use rustc_ast::token; +use rustc_ast::tokenstream::{DelimSpan, TokenStream, TokenTree}; use rustc_ast_pretty::pprust; use rustc_errors::{struct_span_err, Applicability, PResult, StashKey}; use rustc_span::source_map::{self, Span}; use rustc_span::symbol::{kw, sym, Symbol}; -use syntax::ast::{self, AttrStyle, AttrVec, Attribute, Ident, DUMMY_NODE_ID}; -use syntax::ast::{AssocItem, AssocItemKind, ForeignItemKind, Item, ItemKind}; -use syntax::ast::{Async, Const, Defaultness, IsAuto, PathSegment, Unsafe, UseTree, UseTreeKind}; -use syntax::ast::{BindingMode, Block, FnDecl, FnSig, Mac, MacArgs, MacDelimiter, Param, SelfKind}; -use syntax::ast::{EnumDef, Generics, StructField, TraitRef, Ty, TyKind, Variant, VariantData}; -use syntax::ast::{FnHeader, ForeignItem, Mutability, Visibility, VisibilityKind}; -use syntax::ptr::P; -use syntax::token; -use syntax::tokenstream::{DelimSpan, TokenStream, TokenTree}; use log::debug; use std::mem; diff --git a/src/librustc_parse/parser/mod.rs b/src/librustc_parse/parser/mod.rs index 58a03ee2a74b4..63a19d5de540f 100644 --- a/src/librustc_parse/parser/mod.rs +++ b/src/librustc_parse/parser/mod.rs @@ -16,19 +16,21 @@ use crate::lexer::UnmatchedBrace; use crate::{Directory, DirectoryOwnership}; use log::debug; +use rustc_ast::ast::DUMMY_NODE_ID; +use rustc_ast::ast::{self, AttrStyle, AttrVec, Const, CrateSugar, Extern, Ident, 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::util::comments::{doc_comment_style, strip_doc_comment_decoration}; use rustc_ast_pretty::pprust; use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, FatalError, PResult}; use rustc_session::parse::ParseSess; use rustc_span::source_map::respan; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::{FileName, Span, DUMMY_SP}; -use syntax::ast::DUMMY_NODE_ID; -use syntax::ast::{self, AttrStyle, AttrVec, Const, CrateSugar, Extern, Ident, Unsafe}; -use syntax::ast::{Async, MacArgs, MacDelimiter, Mutability, StrLit, Visibility, VisibilityKind}; -use syntax::ptr::P; -use syntax::token::{self, DelimToken, Token, TokenKind}; -use syntax::tokenstream::{self, DelimSpan, TokenStream, TokenTree, TreeAndJoint}; -use syntax::util::comments::{doc_comment_style, strip_doc_comment_decoration}; use std::path::PathBuf; use std::{cmp, mem, slice}; diff --git a/src/librustc_parse/parser/module.rs b/src/librustc_parse/parser/module.rs index 9dba813c9a721..4e9a9a5021b5c 100644 --- a/src/librustc_parse/parser/module.rs +++ b/src/librustc_parse/parser/module.rs @@ -4,12 +4,12 @@ use super::Parser; use crate::{new_sub_parser_from_file, DirectoryOwnership}; +use rustc_ast::ast::{self, Attribute, Crate, Ident, ItemKind, Mod}; +use rustc_ast::attr; +use rustc_ast::token::{self, TokenKind}; use rustc_errors::PResult; use rustc_span::source_map::{FileName, SourceMap, Span, DUMMY_SP}; use rustc_span::symbol::sym; -use syntax::ast::{self, Attribute, Crate, Ident, ItemKind, Mod}; -use syntax::attr; -use syntax::token::{self, TokenKind}; use std::path::{self, Path, PathBuf}; diff --git a/src/librustc_parse/parser/pat.rs b/src/librustc_parse/parser/pat.rs index 4dc2f77517321..f379474739785 100644 --- a/src/librustc_parse/parser/pat.rs +++ b/src/librustc_parse/parser/pat.rs @@ -1,14 +1,16 @@ use super::{Parser, PathStyle}; use crate::{maybe_recover_from_interpolated_ty_qpath, maybe_whole}; +use rustc_ast::ast::{ + self, AttrVec, Attribute, FieldPat, Mac, Pat, PatKind, RangeEnd, RangeSyntax, +}; +use rustc_ast::ast::{BindingMode, Expr, ExprKind, Ident, Mutability, Path, QSelf}; +use rustc_ast::mut_visit::{noop_visit_mac, noop_visit_pat, MutVisitor}; +use rustc_ast::ptr::P; +use rustc_ast::token; use rustc_ast_pretty::pprust; use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, PResult}; use rustc_span::source_map::{respan, Span, Spanned}; use rustc_span::symbol::{kw, sym}; -use syntax::ast::{self, AttrVec, Attribute, FieldPat, Mac, Pat, PatKind, RangeEnd, RangeSyntax}; -use syntax::ast::{BindingMode, Expr, ExprKind, Ident, Mutability, Path, QSelf}; -use syntax::mut_visit::{noop_visit_mac, noop_visit_pat, MutVisitor}; -use syntax::ptr::P; -use syntax::token; type Expected = Option<&'static str>; diff --git a/src/librustc_parse/parser/path.rs b/src/librustc_parse/parser/path.rs index 1db920625e3cf..6a71ebe218342 100644 --- a/src/librustc_parse/parser/path.rs +++ b/src/librustc_parse/parser/path.rs @@ -1,14 +1,16 @@ use super::ty::{AllowPlus, RecoverQPath}; use super::{Parser, TokenType}; use crate::maybe_whole; +use rustc_ast::ast::{ + self, AngleBracketedArgs, Ident, ParenthesizedArgs, Path, PathSegment, QSelf, +}; +use rustc_ast::ast::{ + AnonConst, AssocTyConstraint, AssocTyConstraintKind, BlockCheckMode, GenericArg, +}; +use rustc_ast::token::{self, Token}; use rustc_errors::{pluralize, Applicability, PResult}; use rustc_span::source_map::{BytePos, Span}; use rustc_span::symbol::{kw, sym}; -use syntax::ast::{self, AngleBracketedArgs, Ident, ParenthesizedArgs, Path, PathSegment, QSelf}; -use syntax::ast::{ - AnonConst, AssocTyConstraint, AssocTyConstraintKind, BlockCheckMode, GenericArg, -}; -use syntax::token::{self, Token}; use log::debug; use std::mem; diff --git a/src/librustc_parse/parser/stmt.rs b/src/librustc_parse/parser/stmt.rs index 9073e131f700d..e0d8699442f36 100644 --- a/src/librustc_parse/parser/stmt.rs +++ b/src/librustc_parse/parser/stmt.rs @@ -6,15 +6,15 @@ use super::{BlockMode, Parser, Restrictions, SemiColonMode}; use crate::maybe_whole; use crate::DirectoryOwnership; +use rustc_ast::ast; +use rustc_ast::ast::{AttrStyle, AttrVec, Attribute, Mac, MacStmtStyle}; +use rustc_ast::ast::{Block, BlockCheckMode, Expr, ExprKind, Local, Stmt, StmtKind, DUMMY_NODE_ID}; +use rustc_ast::ptr::P; +use rustc_ast::token::{self, TokenKind}; +use rustc_ast::util::classify; use rustc_errors::{Applicability, PResult}; use rustc_span::source_map::{BytePos, Span}; use rustc_span::symbol::{kw, sym}; -use syntax::ast; -use syntax::ast::{AttrStyle, AttrVec, Attribute, Mac, MacStmtStyle}; -use syntax::ast::{Block, BlockCheckMode, Expr, ExprKind, Local, Stmt, StmtKind, DUMMY_NODE_ID}; -use syntax::ptr::P; -use syntax::token::{self, TokenKind}; -use syntax::util::classify; use std::mem; diff --git a/src/librustc_parse/parser/ty.rs b/src/librustc_parse/parser/ty.rs index 7b2fdebcfb910..8d100c344fa90 100644 --- a/src/librustc_parse/parser/ty.rs +++ b/src/librustc_parse/parser/ty.rs @@ -2,16 +2,16 @@ 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, PolyTraitRef, TraitBoundModifier, TraitObjectSyntax, +}; +use rustc_ast::ast::{Mac, Mutability}; +use rustc_ast::ptr::P; +use rustc_ast::token::{self, Token, TokenKind}; use rustc_errors::{pluralize, struct_span_err, Applicability, PResult}; use rustc_span::source_map::Span; use rustc_span::symbol::{kw, sym}; -use syntax::ast::{self, BareFnTy, FnRetTy, GenericParam, Lifetime, MutTy, Ty, TyKind}; -use syntax::ast::{ - GenericBound, GenericBounds, PolyTraitRef, TraitBoundModifier, TraitObjectSyntax, -}; -use syntax::ast::{Mac, Mutability}; -use syntax::ptr::P; -use syntax::token::{self, Token, TokenKind}; /// Any `?` or `?const` modifiers that appear at the start of a bound. struct BoundModifiers { diff --git a/src/librustc_parse/validate_attr.rs b/src/librustc_parse/validate_attr.rs index f5e47608d589d..029aa5ed2baea 100644 --- a/src/librustc_parse/validate_attr.rs +++ b/src/librustc_parse/validate_attr.rs @@ -2,13 +2,13 @@ use crate::parse_in; +use rustc_ast::ast::{self, Attribute, MacArgs, MacDelimiter, MetaItem, MetaItemKind}; +use rustc_ast::tokenstream::DelimSpan; use rustc_errors::{Applicability, PResult}; use rustc_feature::{AttributeTemplate, BUILTIN_ATTRIBUTE_MAP}; use rustc_session::lint::builtin::ILL_FORMED_ATTRIBUTE_INPUT; use rustc_session::parse::ParseSess; use rustc_span::{sym, Symbol}; -use syntax::ast::{self, Attribute, MacArgs, MacDelimiter, MetaItem, MetaItemKind}; -use syntax::tokenstream::DelimSpan; pub fn check_meta(sess: &ParseSess, attr: &Attribute) { if attr.is_doc_comment() { diff --git a/src/librustc_passes/Cargo.toml b/src/librustc_passes/Cargo.toml index 41718b21f520c..af8e7a5b71e46 100644 --- a/src/librustc_passes/Cargo.toml +++ b/src/librustc_passes/Cargo.toml @@ -20,5 +20,5 @@ rustc_index = { path = "../librustc_index" } rustc_infer = { path = "../librustc_infer" } rustc_session = { path = "../librustc_session" } rustc_target = { path = "../librustc_target" } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } rustc_span = { path = "../librustc_span" } diff --git a/src/librustc_passes/check_attr.rs b/src/librustc_passes/check_attr.rs index 5cabf3c0262a1..f1ed074d6ab77 100644 --- a/src/librustc_passes/check_attr.rs +++ b/src/librustc_passes/check_attr.rs @@ -8,6 +8,8 @@ use rustc::hir::map::Map; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_ast::ast::{Attribute, NestedMetaItem}; +use rustc_ast::attr; use rustc_errors::struct_span_err; use rustc_hir as hir; use rustc_hir::def_id::DefId; @@ -19,8 +21,6 @@ use rustc_session::lint::builtin::{CONFLICTING_REPR_HINTS, UNUSED_ATTRIBUTES}; use rustc_session::parse::feature_err; use rustc_span::symbol::sym; use rustc_span::Span; -use syntax::ast::{Attribute, NestedMetaItem}; -use syntax::attr; fn target_from_impl_item<'tcx>(tcx: TyCtxt<'tcx>, impl_item: &hir::ImplItem<'_>) -> Target { match impl_item.kind { diff --git a/src/librustc_passes/check_const.rs b/src/librustc_passes/check_const.rs index d713a82fd887e..53e8213ae4807 100644 --- a/src/librustc_passes/check_const.rs +++ b/src/librustc_passes/check_const.rs @@ -13,12 +13,12 @@ use rustc::session::config::nightly_options; use rustc::session::parse::feature_err; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_ast::ast::Mutability; use rustc_errors::struct_span_err; use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc_span::{sym, Span, Symbol}; -use syntax::ast::Mutability; use std::fmt; diff --git a/src/librustc_passes/dead.rs b/src/librustc_passes/dead.rs index e2749c7bd7c88..bcf9fd5a5353f 100644 --- a/src/librustc_passes/dead.rs +++ b/src/librustc_passes/dead.rs @@ -15,8 +15,8 @@ use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_hir::{Node, PatKind, TyKind}; use rustc_session::lint; +use rustc_ast::{ast, attr}; use rustc_span::symbol::sym; -use syntax::{ast, attr}; // Any local node that may call something in its body block should be // explored. For example, if it's a live Node::Item that is a diff --git a/src/librustc_passes/diagnostic_items.rs b/src/librustc_passes/diagnostic_items.rs index 5e831b558a350..ae23e9e35f93e 100644 --- a/src/librustc_passes/diagnostic_items.rs +++ b/src/librustc_passes/diagnostic_items.rs @@ -11,12 +11,12 @@ use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_ast::ast; use rustc_data_structures::fx::FxHashMap; use rustc_hir as hir; use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_span::symbol::{sym, Symbol}; -use syntax::ast; struct DiagnosticItemCollector<'tcx> { // items from this crate diff --git a/src/librustc_passes/entry.rs b/src/librustc_passes/entry.rs index ebd93e9ab85b8..f2239ad16eeb3 100644 --- a/src/librustc_passes/entry.rs +++ b/src/librustc_passes/entry.rs @@ -3,14 +3,14 @@ use rustc::session::config::EntryFnType; use rustc::session::{config, Session}; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_ast::attr; +use rustc_ast::entry::EntryPointType; use rustc_errors::struct_span_err; use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_hir::{HirId, ImplItem, Item, ItemKind, TraitItem}; use rustc_span::symbol::sym; use rustc_span::{Span, DUMMY_SP}; -use syntax::attr; -use syntax::entry::EntryPointType; struct EntryContext<'a, 'tcx> { session: &'a Session, @@ -77,7 +77,7 @@ fn entry_fn(tcx: TyCtxt<'_>, cnum: CrateNum) -> Option<(DefId, EntryFnType)> { configure_main(tcx, &ctxt) } -// Beware, this is duplicated in `libsyntax/entry.rs`, so make sure to keep +// Beware, this is duplicated in `librustc_ast/entry.rs`, so make sure to keep // them in sync. fn entry_point_type(item: &Item<'_>, at_root: bool) -> EntryPointType { match item.kind { diff --git a/src/librustc_passes/hir_stats.rs b/src/librustc_passes/hir_stats.rs index c6c201fa38ec1..c819809041f28 100644 --- a/src/librustc_passes/hir_stats.rs +++ b/src/librustc_passes/hir_stats.rs @@ -4,13 +4,13 @@ use rustc::hir::map::Map; use rustc::util::common::to_readable_str; +use rustc_ast::ast::{self, AttrId, NodeId}; +use rustc_ast::visit as ast_visit; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir as hir; use rustc_hir::intravisit as hir_visit; use rustc_hir::HirId; use rustc_span::Span; -use syntax::ast::{self, AttrId, NodeId}; -use syntax::visit as ast_visit; #[derive(Copy, Clone, PartialEq, Eq, Hash)] enum Id { diff --git a/src/librustc_passes/layout_test.rs b/src/librustc_passes/layout_test.rs index be3e1f4738234..9f6598a0ec1fe 100644 --- a/src/librustc_passes/layout_test.rs +++ b/src/librustc_passes/layout_test.rs @@ -7,12 +7,12 @@ use rustc::ty::layout::TyLayout; use rustc::ty::ParamEnv; use rustc::ty::Ty; use rustc::ty::TyCtxt; +use rustc_ast::ast::Attribute; use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_hir::ItemKind; use rustc_span::symbol::sym; -use syntax::ast::Attribute; pub fn test_layout(tcx: TyCtxt<'_>) { if tcx.features().rustc_attrs { diff --git a/src/librustc_passes/lib_features.rs b/src/librustc_passes/lib_features.rs index 2e306a1b4f2a1..172d7e7628e21 100644 --- a/src/librustc_passes/lib_features.rs +++ b/src/librustc_passes/lib_features.rs @@ -8,12 +8,12 @@ use rustc::hir::map::Map; use rustc::middle::lib_features::LibFeatures; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_ast::ast::{Attribute, MetaItem, MetaItemKind}; use rustc_errors::struct_span_err; use rustc_hir::def_id::LOCAL_CRATE; use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc_span::symbol::Symbol; use rustc_span::{sym, Span}; -use syntax::ast::{Attribute, MetaItem, MetaItemKind}; fn new_lib_features() -> LibFeatures { LibFeatures { stable: Default::default(), unstable: Default::default() } diff --git a/src/librustc_passes/liveness.rs b/src/librustc_passes/liveness.rs index f0bb3cd08ad82..43b615dee9811 100644 --- a/src/librustc_passes/liveness.rs +++ b/src/librustc_passes/liveness.rs @@ -100,6 +100,7 @@ use rustc::hir::map::Map; use rustc::lint; use rustc::ty::query::Providers; use rustc::ty::{self, TyCtxt}; +use rustc_ast::ast; use rustc_data_structures::fx::FxIndexMap; use rustc_errors::Applicability; use rustc_hir as hir; @@ -109,7 +110,6 @@ use rustc_hir::intravisit::{self, FnKind, NestedVisitorMap, Visitor}; use rustc_hir::{Expr, HirId, HirIdMap, HirIdSet, Node}; use rustc_span::symbol::sym; use rustc_span::Span; -use syntax::ast; use std::collections::VecDeque; use std::io; diff --git a/src/librustc_passes/region.rs b/src/librustc_passes/region.rs index d0f49fdcc758c..e636144794ab6 100644 --- a/src/librustc_passes/region.rs +++ b/src/librustc_passes/region.rs @@ -10,6 +10,7 @@ use rustc::hir::map::Map; use rustc::middle::region::*; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_ast::walk_list; use rustc_data_structures::fx::FxHashSet; use rustc_hir as hir; use rustc_hir::def_id::DefId; @@ -18,7 +19,6 @@ use rustc_hir::{Arm, Block, Expr, Local, Node, Pat, PatKind, Stmt}; use rustc_index::vec::Idx; use rustc_span::source_map; use rustc_span::Span; -use syntax::walk_list; use std::mem; diff --git a/src/librustc_passes/stability.rs b/src/librustc_passes/stability.rs index 99fbac4568e4f..5eae935f050e1 100644 --- a/src/librustc_passes/stability.rs +++ b/src/librustc_passes/stability.rs @@ -9,6 +9,7 @@ use rustc::session::parse::feature_err; use rustc::session::Session; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_ast::ast::Attribute; use rustc_attr::{self as attr, ConstStability, Stability}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::struct_span_err; @@ -20,7 +21,6 @@ use rustc_hir::{Generics, HirId, Item, StructField, Variant}; use rustc_infer::traits::misc::can_type_implement_copy; use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; -use syntax::ast::Attribute; use std::cmp::Ordering; use std::mem::replace; diff --git a/src/librustc_plugin_impl/Cargo.toml b/src/librustc_plugin_impl/Cargo.toml index 2214838c84683..8931307259021 100644 --- a/src/librustc_plugin_impl/Cargo.toml +++ b/src/librustc_plugin_impl/Cargo.toml @@ -16,5 +16,5 @@ rustc_errors = { path = "../librustc_errors" } rustc_hir = { path = "../librustc_hir" } rustc_lint = { path = "../librustc_lint" } rustc_metadata = { path = "../librustc_metadata" } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } rustc_span = { path = "../librustc_span" } diff --git a/src/librustc_plugin_impl/build.rs b/src/librustc_plugin_impl/build.rs index c4b644031d3a6..03e58d758c5b5 100644 --- a/src/librustc_plugin_impl/build.rs +++ b/src/librustc_plugin_impl/build.rs @@ -2,12 +2,12 @@ use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_ast::attr; use rustc_hir as hir; use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_span::symbol::sym; use rustc_span::Span; -use syntax::attr; struct RegistrarFinder { registrars: Vec<(hir::HirId, Span)>, diff --git a/src/librustc_plugin_impl/load.rs b/src/librustc_plugin_impl/load.rs index 84549c0dd4554..9bd9bcb25ba88 100644 --- a/src/librustc_plugin_impl/load.rs +++ b/src/librustc_plugin_impl/load.rs @@ -3,11 +3,11 @@ use crate::Registry; use rustc::middle::cstore::MetadataLoader; use rustc::session::Session; +use rustc_ast::ast::{Crate, Ident}; use rustc_errors::struct_span_err; use rustc_metadata::locator; use rustc_span::symbol::sym; use rustc_span::Span; -use syntax::ast::{Crate, Ident}; use std::borrow::ToOwned; use std::env; diff --git a/src/librustc_privacy/Cargo.toml b/src/librustc_privacy/Cargo.toml index 2f7aaf9e5cfe1..6d1272c117b4d 100644 --- a/src/librustc_privacy/Cargo.toml +++ b/src/librustc_privacy/Cargo.toml @@ -14,7 +14,7 @@ rustc_attr = { path = "../librustc_attr" } rustc_errors = { path = "../librustc_errors" } rustc_hir = { path = "../librustc_hir" } rustc_typeck = { path = "../librustc_typeck" } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } rustc_span = { path = "../librustc_span" } rustc_data_structures = { path = "../librustc_data_structures" } log = "0.4" diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index ef1e99c5a64be..8edadc4487544 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -11,6 +11,7 @@ use rustc::ty::fold::TypeVisitor; use rustc::ty::query::Providers; use rustc::ty::subst::InternalSubsts; use rustc::ty::{self, GenericParamDefKind, TraitRef, Ty, TyCtxt, TypeFoldable}; +use rustc_ast::ast::Ident; use rustc_attr as attr; use rustc_data_structures::fx::FxHashSet; use rustc_errors::struct_span_err; @@ -22,7 +23,6 @@ use rustc_hir::{AssocItemKind, HirIdSet, Node, PatKind}; use rustc_span::hygiene::Transparency; use rustc_span::symbol::{kw, sym}; use rustc_span::Span; -use syntax::ast::Ident; use std::marker::PhantomData; use std::{cmp, fmt, mem}; diff --git a/src/librustc_resolve/Cargo.toml b/src/librustc_resolve/Cargo.toml index a40c3ca0f9eca..11a3cedcc74e9 100644 --- a/src/librustc_resolve/Cargo.toml +++ b/src/librustc_resolve/Cargo.toml @@ -13,7 +13,7 @@ doctest = false [dependencies] bitflags = "1.2.1" log = "0.4" -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } arena = { path = "../libarena" } rustc = { path = "../librustc" } rustc_ast_lowering = { path = "../librustc_ast_lowering" } diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 2a9e335e924a2..86816fd9f3a2a 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -20,6 +20,11 @@ use rustc::bug; use rustc::hir::exports::Export; use rustc::middle::cstore::CrateStore; use rustc::ty; +use rustc_ast::ast::{self, Block, ForeignItem, ForeignItemKind, Item, ItemKind, NodeId}; +use rustc_ast::ast::{AssocItem, AssocItemKind, MetaItemKind, StmtKind}; +use rustc_ast::ast::{Ident, Name}; +use rustc_ast::token::{self, Token}; +use rustc_ast::visit::{self, AssocCtxt, Visitor}; use rustc_attr as attr; use rustc_data_structures::sync::Lrc; use rustc_errors::{struct_span_err, Applicability}; @@ -32,11 +37,6 @@ use rustc_span::hygiene::{ExpnId, MacroKind}; use rustc_span::source_map::{respan, Spanned}; use rustc_span::symbol::{kw, sym}; use rustc_span::{Span, DUMMY_SP}; -use syntax::ast::{self, Block, ForeignItem, ForeignItemKind, Item, ItemKind, NodeId}; -use syntax::ast::{AssocItem, AssocItemKind, MetaItemKind, StmtKind}; -use syntax::ast::{Ident, Name}; -use syntax::token::{self, Token}; -use syntax::visit::{self, AssocCtxt, Visitor}; use log::debug; use std::cell::Cell; diff --git a/src/librustc_resolve/check_unused.rs b/src/librustc_resolve/check_unused.rs index 74154cb3df415..659a54b169b39 100644 --- a/src/librustc_resolve/check_unused.rs +++ b/src/librustc_resolve/check_unused.rs @@ -27,13 +27,13 @@ use crate::imports::ImportDirectiveSubclass; use crate::Resolver; use rustc::{lint, ty}; +use rustc_ast::ast; +use rustc_ast::node_id::NodeMap; +use rustc_ast::visit::{self, Visitor}; use rustc_data_structures::fx::FxHashSet; use rustc_errors::pluralize; use rustc_session::lint::BuiltinLintDiagnostics; use rustc_span::{MultiSpan, Span, DUMMY_SP}; -use syntax::ast; -use syntax::node_id::NodeMap; -use syntax::visit::{self, Visitor}; struct UnusedImport<'a> { use_tree: &'a ast::UseTree, diff --git a/src/librustc_resolve/def_collector.rs b/src/librustc_resolve/def_collector.rs index 30089633689c4..2e687c88941fa 100644 --- a/src/librustc_resolve/def_collector.rs +++ b/src/librustc_resolve/def_collector.rs @@ -1,13 +1,13 @@ use log::debug; use rustc::hir::map::definitions::*; +use rustc_ast::ast::*; +use rustc_ast::token::{self, Token}; +use rustc_ast::visit; use rustc_expand::expand::AstFragment; use rustc_hir::def_id::DefIndex; use rustc_span::hygiene::ExpnId; use rustc_span::symbol::{kw, sym}; use rustc_span::Span; -use syntax::ast::*; -use syntax::token::{self, Token}; -use syntax::visit; crate fn collect_definitions( definitions: &mut Definitions, diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index d08ae3040bda7..6d9c78cddf222 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -4,6 +4,8 @@ use log::debug; use rustc::bug; use rustc::session::Session; use rustc::ty::{self, DefIdTree}; +use rustc_ast::ast::{self, Ident, Path}; +use rustc_ast::util::lev_distance::find_best_match_for_name; use rustc_ast_pretty::pprust; use rustc_data_structures::fx::FxHashSet; use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder}; @@ -15,8 +17,6 @@ use rustc_span::hygiene::MacroKind; use rustc_span::source_map::SourceMap; use rustc_span::symbol::{kw, Symbol}; use rustc_span::{BytePos, MultiSpan, Span}; -use syntax::ast::{self, Ident, Path}; -use syntax::util::lev_distance::find_best_match_for_name; use crate::imports::{ImportDirective, ImportDirectiveSubclass, ImportResolver}; use crate::path_names_to_string; diff --git a/src/librustc_resolve/imports.rs b/src/librustc_resolve/imports.rs index 3926849e7cad1..9198c74d89a4c 100644 --- a/src/librustc_resolve/imports.rs +++ b/src/librustc_resolve/imports.rs @@ -15,6 +15,9 @@ use rustc::hir::exports::Export; use rustc::lint::builtin::{PUB_USE_OF_PRIVATE_EXTERN_CRATE, UNUSED_IMPORTS}; use rustc::ty; use rustc::{bug, span_bug}; +use rustc_ast::ast::{Ident, Name, NodeId}; +use rustc_ast::unwrap_or; +use rustc_ast::util::lev_distance::find_best_match_for_name; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::ptr_key::PtrKey; use rustc_errors::{pluralize, struct_span_err, Applicability}; @@ -25,9 +28,6 @@ use rustc_session::DiagnosticMessageId; use rustc_span::hygiene::ExpnId; use rustc_span::symbol::kw; use rustc_span::{MultiSpan, Span}; -use syntax::ast::{Ident, Name, NodeId}; -use syntax::unwrap_or; -use syntax::util::lev_distance::find_best_match_for_name; use log::*; diff --git a/src/librustc_resolve/late.rs b/src/librustc_resolve/late.rs index c062b7dbe64df..e5aa9c7d8962a 100644 --- a/src/librustc_resolve/late.rs +++ b/src/librustc_resolve/late.rs @@ -12,6 +12,11 @@ use crate::{Module, ModuleOrUniformRoot, NameBindingKind, ParentScope, PathResul use crate::{ResolutionError, Resolver, Segment, UseError}; use rustc::{bug, lint, span_bug}; +use rustc_ast::ast::*; +use rustc_ast::ptr::P; +use rustc_ast::util::lev_distance::find_best_match_for_name; +use rustc_ast::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor}; +use rustc_ast::{unwrap_or, walk_list}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::DiagnosticId; use rustc_hir::def::Namespace::{self, *}; @@ -21,11 +26,6 @@ use rustc_hir::TraitCandidate; use rustc_span::symbol::{kw, sym}; use rustc_span::Span; use smallvec::{smallvec, SmallVec}; -use syntax::ast::*; -use syntax::ptr::P; -use syntax::util::lev_distance::find_best_match_for_name; -use syntax::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor}; -use syntax::{unwrap_or, walk_list}; use log::debug; use std::collections::BTreeSet; diff --git a/src/librustc_resolve/late/diagnostics.rs b/src/librustc_resolve/late/diagnostics.rs index b7ac8fbe4eba7..817a276ff3e73 100644 --- a/src/librustc_resolve/late/diagnostics.rs +++ b/src/librustc_resolve/late/diagnostics.rs @@ -6,6 +6,8 @@ use crate::{CrateLint, Module, ModuleKind, ModuleOrUniformRoot}; use crate::{PathResult, PathSource, Segment}; use rustc::session::config::nightly_options; +use rustc_ast::ast::{self, Expr, ExprKind, Ident, Item, ItemKind, NodeId, Path, Ty, TyKind}; +use rustc_ast::util::lev_distance::find_best_match_for_name; use rustc_data_structures::fx::FxHashSet; use rustc_errors::{pluralize, struct_span_err, Applicability, DiagnosticBuilder}; use rustc_hir as hir; @@ -16,8 +18,6 @@ use rustc_hir::PrimTy; use rustc_span::hygiene::MacroKind; use rustc_span::symbol::{kw, sym}; use rustc_span::Span; -use syntax::ast::{self, Expr, ExprKind, Ident, Item, ItemKind, NodeId, Path, Ty, TyKind}; -use syntax::util::lev_distance::find_best_match_for_name; use log::debug; diff --git a/src/librustc_resolve/late/lifetimes.rs b/src/librustc_resolve/late/lifetimes.rs index 478757f0db737..463452e45ce99 100644 --- a/src/librustc_resolve/late/lifetimes.rs +++ b/src/librustc_resolve/late/lifetimes.rs @@ -11,6 +11,9 @@ use rustc::lint; use rustc::middle::resolve_lifetime::*; use rustc::ty::{self, DefIdTree, GenericParamDefKind, TyCtxt}; use rustc::{bug, span_bug}; +use rustc_ast::ast; +use rustc_ast::attr; +use rustc_ast::walk_list; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder}; use rustc_hir as hir; @@ -24,9 +27,6 @@ use rustc_span::Span; use std::borrow::Cow; use std::cell::Cell; use std::mem::{replace, take}; -use syntax::ast; -use syntax::attr; -use syntax::walk_list; use log::debug; @@ -2719,7 +2719,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { span_bug!( lifetime_ref.span, "lifetime reference not renumbered, \ - probably a bug in syntax::fold" + probably a bug in rustc_ast::fold" ); } diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 540877d22c2d4..44eba0d533d3a 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -23,6 +23,13 @@ use rustc::middle::cstore::{CrateStore, MetadataLoaderDyn}; use rustc::span_bug; use rustc::ty::query::Providers; use rustc::ty::{self, DefIdTree, ResolverOutputs}; +use rustc_ast::ast::{self, FloatTy, Ident, IntTy, Name, NodeId, UintTy}; +use rustc_ast::ast::{Crate, CRATE_NODE_ID}; +use rustc_ast::ast::{ItemKind, Path}; +use rustc_ast::attr; +use rustc_ast::node_id::{NodeMap, NodeSet}; +use rustc_ast::unwrap_or; +use rustc_ast::visit::{self, Visitor}; use rustc_ast_pretty::pprust; use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap}; use rustc_data_structures::ptr_key::PtrKey; @@ -41,13 +48,6 @@ use rustc_span::hygiene::{ExpnId, ExpnKind, MacroKind, SyntaxContext, Transparen use rustc_span::source_map::Spanned; use rustc_span::symbol::{kw, sym}; use rustc_span::{Span, DUMMY_SP}; -use syntax::ast::{self, FloatTy, Ident, IntTy, Name, NodeId, UintTy}; -use syntax::ast::{Crate, CRATE_NODE_ID}; -use syntax::ast::{ItemKind, Path}; -use syntax::attr; -use syntax::node_id::{NodeMap, NodeSet}; -use syntax::unwrap_or; -use syntax::visit::{self, Visitor}; use log::debug; use std::cell::{Cell, RefCell}; diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index 11139a3dc94fc..e11aec906693e 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -10,6 +10,7 @@ use rustc::middle::stability; use rustc::session::parse::feature_err; use rustc::session::Session; use rustc::{lint, span_bug, ty}; +use rustc_ast::ast::{self, Ident, NodeId}; use rustc_ast_pretty::pprust; use rustc_attr::{self as attr, StabilityLevel}; use rustc_data_structures::fx::FxHashSet; @@ -24,7 +25,6 @@ use rustc_span::edition::Edition; use rustc_span::hygiene::{self, ExpnData, ExpnId, ExpnKind}; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::{Span, DUMMY_SP}; -use syntax::ast::{self, Ident, NodeId}; use rustc_data_structures::sync::Lrc; use rustc_span::hygiene::{AstPass, MacroKind}; diff --git a/src/librustc_save_analysis/Cargo.toml b/src/librustc_save_analysis/Cargo.toml index 2cbed75eaf597..0f4cc4192b626 100644 --- a/src/librustc_save_analysis/Cargo.toml +++ b/src/librustc_save_analysis/Cargo.toml @@ -17,7 +17,7 @@ rustc_codegen_utils = { path = "../librustc_codegen_utils" } rustc_hir = { path = "../librustc_hir" } rustc_parse = { path = "../librustc_parse" } serde_json = "1" -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } rustc_span = { path = "../librustc_span" } rls-data = "0.19" rls-span = "0.5" diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index b3a8657d80bed..e8cd5ea832db0 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -16,17 +16,17 @@ use rustc::session::config::Input; use rustc::span_bug; use rustc::ty::{self, DefIdTree, TyCtxt}; +use rustc_ast::ast::{self, Attribute, NodeId, PatKind}; +use rustc_ast::ptr::P; +use rustc_ast::token; +use rustc_ast::visit::{self, Visitor}; +use rustc_ast::walk_list; use rustc_ast_pretty::pprust::{bounds_to_string, generic_params_to_string, ty_to_string}; use rustc_data_structures::fx::FxHashSet; use rustc_hir::def::{DefKind as HirDefKind, Res}; use rustc_hir::def_id::DefId; use rustc_span::source_map::{respan, DUMMY_SP}; use rustc_span::*; -use syntax::ast::{self, Attribute, NodeId, PatKind}; -use syntax::ptr::P; -use syntax::token; -use syntax::visit::{self, Visitor}; -use syntax::walk_list; use std::env; use std::path::Path; @@ -1260,7 +1260,7 @@ impl<'l, 'tcx> Visitor<'l> for DumpVisitor<'l, 'tcx> { } fn visit_item(&mut self, item: &'l ast::Item) { - use syntax::ast::ItemKind::*; + use rustc_ast::ast::ItemKind::*; self.process_macro_use(item.span); match item.kind { Use(ref use_tree) => { diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index b253559dd5cd5..dddee1c99268e 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -13,6 +13,9 @@ use rustc::middle::privacy::AccessLevels; use rustc::session::config::{CrateType, Input, OutputType}; use rustc::ty::{self, DefIdTree, TyCtxt}; use rustc::{bug, span_bug}; +use rustc_ast::ast::{self, Attribute, NodeId, PatKind, DUMMY_NODE_ID}; +use rustc_ast::util::comments::strip_doc_comment_decoration; +use rustc_ast::visit::{self, Visitor}; use rustc_ast_pretty::pprust::{self, param_to_string, ty_to_string}; use rustc_codegen_utils::link::{filename_for_metadata, out_filename}; use rustc_hir as hir; @@ -21,9 +24,6 @@ use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_hir::Node; use rustc_span::source_map::Spanned; use rustc_span::*; -use syntax::ast::{self, Attribute, NodeId, PatKind, DUMMY_NODE_ID}; -use syntax::util::comments::strip_doc_comment_decoration; -use syntax::visit::{self, Visitor}; use std::cell::Cell; use std::default::Default; diff --git a/src/librustc_save_analysis/sig.rs b/src/librustc_save_analysis/sig.rs index 9670fb1e2c465..4e5ff9aa197de 100644 --- a/src/librustc_save_analysis/sig.rs +++ b/src/librustc_save_analysis/sig.rs @@ -29,9 +29,9 @@ use crate::{id_from_def_id, id_from_node_id, SaveContext}; use rls_data::{SigElement, Signature}; +use rustc_ast::ast::{self, Extern, NodeId}; use rustc_ast_pretty::pprust; use rustc_hir::def::{DefKind, Res}; -use syntax::ast::{self, Extern, NodeId}; pub fn item_signature(item: &ast::Item, scx: &SaveContext<'_, '_>) -> Option { if !scx.config.signatures { diff --git a/src/librustc_save_analysis/span_utils.rs b/src/librustc_save_analysis/span_utils.rs index f904a0bb9f806..152435206fec4 100644 --- a/src/librustc_save_analysis/span_utils.rs +++ b/src/librustc_save_analysis/span_utils.rs @@ -1,8 +1,8 @@ use crate::generated_code; use rustc::session::Session; +use rustc_ast::token::{self, TokenKind}; use rustc_parse::lexer::{self, StringReader}; use rustc_span::*; -use syntax::token::{self, TokenKind}; #[derive(Clone)] pub struct SpanUtils<'a> { diff --git a/src/librustc_session/Cargo.toml b/src/librustc_session/Cargo.toml index c74011e26aae8..3895d0f8061c0 100644 --- a/src/librustc_session/Cargo.toml +++ b/src/librustc_session/Cargo.toml @@ -19,4 +19,4 @@ rustc_span = { path = "../librustc_span" } rustc_index = { path = "../librustc_index" } rustc_fs_util = { path = "../librustc_fs_util" } num_cpus = "1.0" -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } diff --git a/src/librustc_session/lint.rs b/src/librustc_session/lint.rs index 6d4f1ff5b4877..3b79972ccbf5b 100644 --- a/src/librustc_session/lint.rs +++ b/src/librustc_session/lint.rs @@ -1,8 +1,8 @@ pub use self::Level::*; +use rustc_ast::node_id::{NodeId, NodeMap}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey}; use rustc_span::edition::Edition; use rustc_span::{sym, symbol::Ident, MultiSpan, Span, Symbol}; -use syntax::node_id::{NodeId, NodeMap}; pub mod builtin; diff --git a/src/librustc_session/parse.rs b/src/librustc_session/parse.rs index 6d4f4be03ecb2..387d35422c43e 100644 --- a/src/librustc_session/parse.rs +++ b/src/librustc_session/parse.rs @@ -2,6 +2,7 @@ //! It also serves as an input to the parser itself. use crate::lint::{BufferedEarlyLint, BuiltinLintDiagnostics, Lint, LintId}; +use rustc_ast::node_id::NodeId; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::sync::{Lock, Lrc, Once}; use rustc_errors::{emitter::SilentEmitter, ColorConfig, Handler}; @@ -11,7 +12,6 @@ use rustc_span::edition::Edition; use rustc_span::hygiene::ExpnId; use rustc_span::source_map::{FilePathMapping, SourceMap}; use rustc_span::{MultiSpan, Span, Symbol}; -use syntax::node_id::NodeId; use std::path::PathBuf; use std::str; diff --git a/src/librustc_span/lib.rs b/src/librustc_span/lib.rs index a361267b59e36..502ea64aab9b5 100644 --- a/src/librustc_span/lib.rs +++ b/src/librustc_span/lib.rs @@ -89,7 +89,7 @@ pub enum FileName { QuoteExpansion(u64), /// Command line. Anon(u64), - /// Hack in `src/libsyntax/parse.rs`. + /// Hack in `src/librustc_ast/parse.rs`. // FIXME(jseyfried) MacroExpansion(u64), ProcMacroSourceCode(u64), diff --git a/src/librustc_traits/Cargo.toml b/src/librustc_traits/Cargo.toml index 40ca2ea90f2f4..3fdbb4e68057d 100644 --- a/src/librustc_traits/Cargo.toml +++ b/src/librustc_traits/Cargo.toml @@ -15,7 +15,7 @@ rustc_data_structures = { path = "../librustc_data_structures" } rustc_hir = { path = "../librustc_hir" } rustc_macros = { path = "../librustc_macros" } rustc_target = { path = "../librustc_target" } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } rustc_span = { path = "../librustc_span" } chalk-engine = { version = "0.9.0", default-features=false } smallvec = { version = "1.0", features = ["union", "may_dangle"] } diff --git a/src/librustc_traits/lowering/mod.rs b/src/librustc_traits/lowering/mod.rs index b77c603da9a74..12325ad706f0a 100644 --- a/src/librustc_traits/lowering/mod.rs +++ b/src/librustc_traits/lowering/mod.rs @@ -9,12 +9,12 @@ use rustc::traits::{ use rustc::ty::query::Providers; use rustc::ty::subst::{InternalSubsts, Subst}; use rustc::ty::{self, List, TyCtxt}; +use rustc_ast::ast; use rustc_hir as hir; use rustc_hir::def::DefKind; use rustc_hir::def_id::DefId; use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc_span::symbol::sym; -use syntax::ast; use std::iter; diff --git a/src/librustc_typeck/Cargo.toml b/src/librustc_typeck/Cargo.toml index f1890f9f4e6f1..51a9b259c8f70 100644 --- a/src/librustc_typeck/Cargo.toml +++ b/src/librustc_typeck/Cargo.toml @@ -20,7 +20,7 @@ rustc_errors = { path = "../librustc_errors" } rustc_hir = { path = "../librustc_hir" } rustc_target = { path = "../librustc_target" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } -syntax = { path = "../libsyntax" } +rustc_ast = { path = "../librustc_ast" } rustc_span = { path = "../librustc_span" } rustc_index = { path = "../librustc_index" } rustc_infer = { path = "../librustc_infer" } diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index a4213173d368b..bef14d3f4a37b 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -16,6 +16,8 @@ use rustc::session::{parse::feature_err, Session}; use rustc::ty::subst::{self, InternalSubsts, Subst, SubstsRef}; use rustc::ty::{self, Const, DefIdTree, ToPredicate, Ty, TyCtxt, TypeFoldable, WithConstness}; use rustc::ty::{GenericParamDef, GenericParamDefKind}; +use rustc_ast::ast; +use rustc_ast::util::lev_distance::find_best_match_for_name; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::{pluralize, struct_span_err, Applicability, DiagnosticId}; use rustc_hir as hir; @@ -32,8 +34,6 @@ use rustc_span::symbol::sym; use rustc_span::{MultiSpan, Span, DUMMY_SP}; use rustc_target::spec::abi; use smallvec::SmallVec; -use syntax::ast; -use syntax::util::lev_distance::find_best_match_for_name; use std::collections::BTreeSet; use std::iter; diff --git a/src/librustc_typeck/check/autoderef.rs b/src/librustc_typeck/check/autoderef.rs index 00e91decf78b8..67bfb090253f0 100644 --- a/src/librustc_typeck/check/autoderef.rs +++ b/src/librustc_typeck/check/autoderef.rs @@ -10,8 +10,8 @@ use rustc_hir as hir; use rustc_infer::infer::{InferCtxt, InferOk}; use rustc_infer::traits::{self, TraitEngine}; +use rustc_ast::ast::Ident; use rustc_span::Span; -use syntax::ast::Ident; use std::iter; diff --git a/src/librustc_typeck/check/callee.rs b/src/librustc_typeck/check/callee.rs index d0d07334fa515..3f8019e64b2db 100644 --- a/src/librustc_typeck/check/callee.rs +++ b/src/librustc_typeck/check/callee.rs @@ -6,6 +6,7 @@ use crate::type_error_struct; use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability}; use rustc::ty::subst::SubstsRef; use rustc::ty::{self, Ty, TyCtxt, TypeFoldable}; +use rustc_ast::ast::Ident; use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder}; use rustc_hir as hir; use rustc_hir::def::Res; @@ -14,7 +15,6 @@ use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKi use rustc_infer::{infer, traits}; use rustc_span::Span; use rustc_target::spec::abi; -use syntax::ast::Ident; /// Checks that it is legal to call methods of the trait corresponding /// to `trait_id` (this only cares about the trait, not the specific diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs index a67ceb856ce0c..ff100c261f14a 100644 --- a/src/librustc_typeck/check/cast.rs +++ b/src/librustc_typeck/check/cast.rs @@ -41,12 +41,12 @@ use rustc::ty::cast::{CastKind, CastTy}; use rustc::ty::error::TypeError; use rustc::ty::subst::SubstsRef; use rustc::ty::{self, Ty, TypeAndMut, TypeFoldable}; +use rustc_ast::ast; use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder}; use rustc_hir as hir; use rustc_infer::traits; use rustc_infer::traits::error_reporting::report_object_safety_error; use rustc_span::Span; -use syntax::ast; /// Reifies a cast check to be checked once we have full type information for /// a function context. diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 761e2fa8eac88..0c5f3d3e99d75 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -4,12 +4,12 @@ use rustc_infer::traits::{self, ObligationCause}; use rustc::ty::adjustment::AllowTwoPhase; use rustc::ty::{self, AssocItem, Ty}; +use rustc_ast::util::parser::PREC_POSTFIX; use rustc_errors::{Applicability, DiagnosticBuilder}; use rustc_hir as hir; use rustc_hir::{is_range_literal, print, Node}; use rustc_span::symbol::sym; use rustc_span::Span; -use syntax::util::parser::PREC_POSTFIX; use super::method::probe; diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs index 38d73256469fe..124d0f4b73164 100644 --- a/src/librustc_typeck/check/expr.rs +++ b/src/librustc_typeck/check/expr.rs @@ -23,6 +23,8 @@ use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoB use rustc::ty::Ty; use rustc::ty::TypeFoldable; use rustc::ty::{AdtKind, Visibility}; +use rustc_ast::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, DiagnosticId}; use rustc_hir as hir; @@ -35,8 +37,6 @@ use rustc_infer::traits::{self, ObligationCauseCode}; use rustc_span::hygiene::DesugaringKind; use rustc_span::source_map::Span; use rustc_span::symbol::{kw, sym, Symbol}; -use syntax::ast; -use syntax::util::lev_distance::find_best_match_for_name; use std::fmt::Display; diff --git a/src/librustc_typeck/check/method/mod.rs b/src/librustc_typeck/check/method/mod.rs index b09522bbd33da..9b8d88e94b60b 100644 --- a/src/librustc_typeck/check/method/mod.rs +++ b/src/librustc_typeck/check/method/mod.rs @@ -15,6 +15,7 @@ use rustc::ty::subst::Subst; use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::ty::GenericParamDefKind; use rustc::ty::{self, ToPolyTraitRef, ToPredicate, Ty, TypeFoldable, WithConstness}; +use rustc_ast::ast; use rustc_data_structures::sync::Lrc; use rustc_errors::{Applicability, DiagnosticBuilder}; use rustc_hir as hir; @@ -23,7 +24,6 @@ use rustc_hir::def_id::DefId; use rustc_infer::infer::{self, InferOk}; use rustc_infer::traits; use rustc_span::Span; -use syntax::ast; use self::probe::{IsSuggestion, ProbeScope}; diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 3e2826907b880..a52cabd889477 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -16,6 +16,8 @@ use rustc::ty::GenericParamDefKind; use rustc::ty::{ self, ParamEnvAnd, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, TypeFoldable, WithConstness, }; +use rustc_ast::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; use rustc_errors::struct_span_err; @@ -35,8 +37,6 @@ use std::cmp::max; use std::iter; use std::mem; use std::ops::Deref; -use syntax::ast; -use syntax::util::lev_distance::{find_best_match_for_name, lev_distance}; use smallvec::{smallvec, SmallVec}; diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 44f87319ebf4f..33fecb81b60c8 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -7,6 +7,8 @@ use rustc::hir::map as hir_map; use rustc::hir::map::Map; use rustc::ty::print::with_crate_prefix; use rustc::ty::{self, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, TypeFoldable, WithConstness}; +use rustc_ast::ast; +use rustc_ast::util::lev_distance; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::{pluralize, struct_span_err, Applicability, DiagnosticBuilder}; use rustc_hir as hir; @@ -18,8 +20,6 @@ use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKi use rustc_infer::traits::Obligation; use rustc_span::symbol::kw; use rustc_span::{source_map, FileName, Span}; -use syntax::ast; -use syntax::util::lev_distance; use std::cmp::Ordering; diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index ce2af9b96e57c..317574ed963da 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -106,6 +106,8 @@ use rustc::ty::{ self, AdtKind, CanonicalUserType, Const, GenericParamDefKind, RegionKind, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, UserType, WithConstness, }; +use rustc_ast::ast; +use rustc_ast::util::parser::ExprPrecedence; use rustc_attr as attr; use rustc_data_structures::captures::Captures; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; @@ -130,8 +132,6 @@ use rustc_span::source_map::{original_sp, DUMMY_SP}; use rustc_span::symbol::{kw, sym, Ident}; use rustc_span::{self, BytePos, MultiSpan, Span}; use rustc_target::spec::abi::Abi; -use syntax::ast; -use syntax::util::parser::ExprPrecedence; use std::cell::{Cell, Ref, RefCell, RefMut}; use std::cmp; diff --git a/src/librustc_typeck/check/op.rs b/src/librustc_typeck/check/op.rs index b2db02d53c497..bf3511a26143c 100644 --- a/src/librustc_typeck/check/op.rs +++ b/src/librustc_typeck/check/op.rs @@ -5,11 +5,11 @@ use super::{FnCtxt, Needs}; use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability}; use rustc::ty::TyKind::{Adt, Array, Char, FnDef, Never, Ref, Str, Tuple, Uint}; use rustc::ty::{self, Ty, TypeFoldable}; +use rustc_ast::ast::Ident; use rustc_errors::{self, struct_span_err, Applicability, DiagnosticBuilder}; use rustc_hir as hir; use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc_span::Span; -use syntax::ast::Ident; impl<'a, 'tcx> FnCtxt<'a, 'tcx> { /// Checks a `a = b` diff --git a/src/librustc_typeck/check/pat.rs b/src/librustc_typeck/check/pat.rs index d5cc19f986f45..b7aac707a9838 100644 --- a/src/librustc_typeck/check/pat.rs +++ b/src/librustc_typeck/check/pat.rs @@ -1,6 +1,8 @@ use crate::check::FnCtxt; use rustc::ty::subst::GenericArg; use rustc::ty::{self, BindingMode, Ty, TypeFoldable}; +use rustc_ast::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}; use rustc_hir as hir; @@ -12,8 +14,6 @@ use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKi use rustc_infer::traits::{ObligationCause, Pattern}; use rustc_span::hygiene::DesugaringKind; use rustc_span::source_map::{Span, Spanned}; -use syntax::ast; -use syntax::util::lev_distance::find_best_match_for_name; use std::cmp; use std::collections::hash_map::Entry::{Occupied, Vacant}; diff --git a/src/librustc_typeck/check/upvar.rs b/src/librustc_typeck/check/upvar.rs index f42611c63408b..b5ed6335dc011 100644 --- a/src/librustc_typeck/check/upvar.rs +++ b/src/librustc_typeck/check/upvar.rs @@ -37,6 +37,7 @@ use crate::mem_categorization as mc; use crate::mem_categorization::PlaceBase; use rustc::hir::map::Map; use rustc::ty::{self, Ty, TyCtxt, UpvarSubsts}; +use rustc_ast::ast; use rustc_data_structures::fx::FxIndexMap; use rustc_hir as hir; use rustc_hir::def_id::DefId; @@ -44,7 +45,6 @@ use rustc_hir::def_id::LocalDefId; use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc_infer::infer::UpvarRegion; use rustc_span::Span; -use syntax::ast; impl<'a, 'tcx> FnCtxt<'a, 'tcx> { pub fn closure_analyze(&self, body: &'tcx hir::Body<'tcx>) { diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index c13e1e5b668ab..e8e34a4e8f079 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -7,6 +7,7 @@ use rustc::ty::subst::{InternalSubsts, Subst}; use rustc::ty::{ self, AdtKind, GenericParamDefKind, ToPredicate, Ty, TyCtxt, TypeFoldable, WithConstness, }; +use rustc_ast::ast; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder}; use rustc_hir::def_id::DefId; @@ -15,7 +16,6 @@ use rustc_infer::infer::opaque_types::may_define_opaque_type; use rustc_infer::traits::{self, ObligationCause, ObligationCauseCode}; use rustc_span::symbol::sym; use rustc_span::Span; -use syntax::ast; use rustc_hir as hir; use rustc_hir::itemlikevisit::ParItemLikeVisitor; diff --git a/src/librustc_typeck/check_unused.rs b/src/librustc_typeck/check_unused.rs index dd833d9751cb9..3517e09133c28 100644 --- a/src/librustc_typeck/check_unused.rs +++ b/src/librustc_typeck/check_unused.rs @@ -1,5 +1,6 @@ use crate::lint; use rustc::ty::TyCtxt; +use rustc_ast::ast; use rustc_data_structures::fx::FxHashMap; use rustc_errors::Applicability; use rustc_hir as hir; @@ -7,7 +8,6 @@ use rustc_hir::def_id::{DefId, DefIdSet, LOCAL_CRATE}; use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_hir::print::visibility_qualified; use rustc_span::Span; -use syntax::ast; pub fn check_crate(tcx: TyCtxt<'_>) { let mut used_trait_imports = DefIdSet::default(); diff --git a/src/librustc_typeck/coherence/inherent_impls.rs b/src/librustc_typeck/coherence/inherent_impls.rs index 49fa45836e134..60e5df68b5842 100644 --- a/src/librustc_typeck/coherence/inherent_impls.rs +++ b/src/librustc_typeck/coherence/inherent_impls.rs @@ -13,8 +13,8 @@ use rustc_hir as hir; use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc_hir::itemlikevisit::ItemLikeVisitor; +use rustc_ast::ast; use rustc_span::Span; -use syntax::ast; /// On-demand query: yields a map containing all types mapped to their inherent impls. pub fn crate_inherent_impls(tcx: TyCtxt<'_>, crate_num: CrateNum) -> &CrateInherentImpls { diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 252abaee747f5..74111f8864e6b 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -31,6 +31,8 @@ use rustc::ty::util::Discr; use rustc::ty::util::IntTypeExt; use rustc::ty::{self, AdtKind, Const, ToPolyTraitRef, Ty, TyCtxt}; use rustc::ty::{ReprOptions, ToPredicate, WithConstness}; +use rustc_ast::ast; +use rustc_ast::ast::{Ident, MetaItemKind}; use rustc_attr::{list_contains_name, mark_used, InlineAttr, OptimizeAttr}; use rustc_data_structures::captures::Captures; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; @@ -43,8 +45,6 @@ use rustc_hir::{GenericParamKind, Node, Unsafety}; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::{Span, DUMMY_SP}; use rustc_target::spec::abi; -use syntax::ast; -use syntax::ast::{Ident, MetaItemKind}; mod type_of; @@ -2554,7 +2554,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs { } fn check_link_ordinal(tcx: TyCtxt<'_>, attr: &ast::Attribute) -> Option { - use syntax::ast::{Lit, LitIntType, LitKind}; + use rustc_ast::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 da3a277dc2ac6..775d600fc3d4b 100644 --- a/src/librustdoc/clean/cfg.rs +++ b/src/librustdoc/clean/cfg.rs @@ -7,10 +7,10 @@ use std::fmt::{self, Write}; use std::mem; use std::ops; +use rustc_ast::ast::{LitKind, MetaItem, MetaItemKind, NestedMetaItem}; use rustc_feature::Features; use rustc_session::parse::ParseSess; use rustc_span::symbol::{sym, Symbol}; -use syntax::ast::{LitKind, MetaItem, MetaItemKind, NestedMetaItem}; use rustc_span::Span; diff --git a/src/librustdoc/clean/cfg/tests.rs b/src/librustdoc/clean/cfg/tests.rs index d090bf325038f..3b26742e716f8 100644 --- a/src/librustdoc/clean/cfg/tests.rs +++ b/src/librustdoc/clean/cfg/tests.rs @@ -1,10 +1,10 @@ use super::*; +use rustc_ast::ast::*; +use rustc_ast::attr; +use rustc_ast::with_default_globals; use rustc_span::symbol::Symbol; use rustc_span::DUMMY_SP; -use syntax::ast::*; -use syntax::attr; -use syntax::with_default_globals; fn word_cfg(s: &str) -> Cfg { Cfg::Cfg(Symbol::intern(s), None) diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 78222d21b934a..618dfa0d33aae 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -3,6 +3,7 @@ use std::iter::once; use rustc::ty; +use rustc_ast::ast; use rustc_data_structures::fx::FxHashSet; use rustc_hir as hir; use rustc_hir::def::{CtorKind, DefKind, Res}; @@ -13,7 +14,6 @@ use rustc_mir::const_eval::is_min_const_fn; use rustc_span::hygiene::MacroKind; use rustc_span::symbol::sym; use rustc_span::Span; -use syntax::ast; use crate::clean::{self, GetDefId, ToSource, TypeKind}; use crate::core::DocContext; diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 8be6bf8f0d38a..0b26a17e2d55f 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -15,6 +15,7 @@ use rustc::middle::stability; use rustc::ty::fold::TypeFolder; use rustc::ty::subst::InternalSubsts; use rustc::ty::{self, AdtKind, Lift, Ty, TyCtxt}; +use rustc_ast::ast::{self, Ident}; use rustc_attr as attr; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir as hir; @@ -27,7 +28,6 @@ use rustc_span::hygiene::MacroKind; use rustc_span::symbol::{kw, sym}; use rustc_span::{self, Pos}; use rustc_typeck::hir_ty_to_ty; -use syntax::ast::{self, Ident}; use std::collections::hash_map::Entry; use std::default::Default; diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index ee685c90a629b..9c3bedfe37c7a 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -11,6 +11,9 @@ use std::{slice, vec}; use rustc::middle::lang_items; use rustc::middle::stability; use rustc::ty::layout::VariantIdx; +use rustc_ast::ast::{self, AttrStyle, Ident}; +use rustc_ast::attr; +use rustc_ast::util::comments::strip_doc_comment_decoration; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir as hir; use rustc_hir::def::Res; @@ -22,9 +25,6 @@ use rustc_span::source_map::DUMMY_SP; use rustc_span::symbol::{sym, Symbol}; use rustc_span::{self, FileName}; use rustc_target::spec::abi::Abi; -use syntax::ast::{self, AttrStyle, Ident}; -use syntax::attr; -use syntax::util::comments::strip_doc_comment_decoration; use crate::clean::cfg::Cfg; use crate::clean::external_path; @@ -421,7 +421,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 syntax::ast::NestedMetaItem::MetaItem; + use rustc_ast::ast::NestedMetaItem::MetaItem; if let ast::MetaItemKind::List(ref nmis) = mi.kind { if nmis.len() == 1 { diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index 9863a7db6eabe..99e3d731d0d6f 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -38,7 +38,7 @@ pub fn krate(mut cx: &mut DocContext<'_>) -> Crate { } externs.sort_by(|&(a, _), &(b, _)| a.cmp(&b)); - // Clean the crate, translating the entire libsyntax AST to one that is + // Clean the crate, translating the entire librustc_ast AST to one that is // understood by rustdoc. let mut module = module.clean(cx); let mut masked_crates = FxHashSet::default(); diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 43d3ad218295a..8bc34e949f175 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -14,13 +14,13 @@ use rustc_interface::interface; use rustc_resolve as resolve; use rustc_session::lint; +use rustc_ast::ast::CRATE_NODE_ID; use rustc_attr as attr; use rustc_errors::emitter::{Emitter, EmitterWriter}; use rustc_errors::json::JsonEmitter; use rustc_span::source_map; use rustc_span::symbol::sym; use rustc_span::DUMMY_SP; -use syntax::ast::CRATE_NODE_ID; use rustc_data_structures::sync::{self, Lrc}; use std::cell::RefCell; diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs index 744201a00500b..becdeaba50f78 100644 --- a/src/librustdoc/doctree.rs +++ b/src/librustdoc/doctree.rs @@ -2,10 +2,10 @@ //! manner (and with prettier names) before cleaning. pub use self::StructType::*; +use rustc_ast::ast; +use rustc_ast::ast::Name; use rustc_span::hygiene::MacroKind; use rustc_span::{self, Span}; -use syntax::ast; -use syntax::ast::Name; use rustc_hir as hir; use rustc_hir::def_id::CrateNum; diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index 849c5c3e07220..0b4bb304fe9e0 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -1,6 +1,6 @@ //! Basic syntax highlighting functionality. //! -//! This module uses libsyntax's lexer to provide token-based highlighting for +//! This module uses librustc_ast's lexer to provide token-based highlighting for //! the HTML documentation generated by rustdoc. //! //! Use the `render_with_highlighting` to highlight some rust code. @@ -11,12 +11,12 @@ use std::fmt::Display; use std::io; use std::io::prelude::*; +use rustc_ast::token::{self, Token}; use rustc_parse::lexer; use rustc_session::parse::ParseSess; use rustc_span::source_map::SourceMap; use rustc_span::symbol::{kw, sym}; use rustc_span::{FileName, Span}; -use syntax::token::{self, Token}; /// Highlights `src`, returning the HTML output. pub fn render_with_highlighting( diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 54d5a2efc8ad1..4aa3fa39fb4ba 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -44,6 +44,7 @@ use std::sync::Arc; use rustc::middle::privacy::AccessLevels; use rustc::middle::stability; +use rustc_ast::ast; use rustc_ast_pretty::pprust; use rustc_data_structures::flock; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; @@ -57,7 +58,6 @@ use rustc_span::source_map::FileName; use rustc_span::symbol::{sym, Symbol}; use serde::ser::SerializeSeq; use serde::{Serialize, Serializer}; -use syntax::ast; use crate::clean::{self, AttributesExt, Deprecation, GetDefId, SelfTy}; use crate::config::RenderOptions; diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index eab88b7165d6b..4ea14ab9077c6 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -17,6 +17,7 @@ extern crate env_logger; extern crate getopts; extern crate rustc; +extern crate rustc_ast; extern crate rustc_ast_pretty; extern crate rustc_attr; extern crate rustc_data_structures; @@ -38,7 +39,6 @@ extern crate rustc_session; extern crate rustc_span as rustc_span; extern crate rustc_target; extern crate rustc_typeck; -extern crate syntax; extern crate test as testing; #[macro_use] extern crate log; diff --git a/src/librustdoc/passes/calculate_doc_coverage.rs b/src/librustdoc/passes/calculate_doc_coverage.rs index 7ed531c9206af..d4a7f3313a49b 100644 --- a/src/librustdoc/passes/calculate_doc_coverage.rs +++ b/src/librustdoc/passes/calculate_doc_coverage.rs @@ -3,9 +3,9 @@ use crate::core::DocContext; use crate::fold::{self, DocFolder}; use crate::passes::Pass; +use rustc_ast::attr; use rustc_span::symbol::sym; use rustc_span::FileName; -use syntax::attr; use std::collections::BTreeMap; use std::ops; diff --git a/src/librustdoc/passes/check_code_block_syntax.rs b/src/librustdoc/passes/check_code_block_syntax.rs index a6dad3c392044..3e0ff0b3d9a67 100644 --- a/src/librustdoc/passes/check_code_block_syntax.rs +++ b/src/librustdoc/passes/check_code_block_syntax.rs @@ -1,10 +1,10 @@ +use rustc_ast::token; use rustc_data_structures::sync::{Lock, Lrc}; use rustc_errors::{emitter::Emitter, Applicability, Diagnostic, Handler}; use rustc_parse::lexer::StringReader as Lexer; use rustc_session::parse::ParseSess; use rustc_span::source_map::{FilePathMapping, SourceMap}; use rustc_span::{FileName, InnerSpan}; -use syntax::token; use crate::clean; use crate::core::DocContext; diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 0b27e5cf8060f..ad121a667daf5 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -1,5 +1,6 @@ use rustc::lint; use rustc::ty; +use rustc_ast::ast::{self, Ident}; use rustc_errors::Applicability; use rustc_expand::base::SyntaxExtensionKind; use rustc_feature::UnstableFeatures; @@ -13,7 +14,6 @@ use rustc_hir::def_id::DefId; use rustc_resolve::ParentScope; use rustc_span::symbol::Symbol; use rustc_span::DUMMY_SP; -use syntax::ast::{self, Ident}; use std::ops::Range; @@ -60,7 +60,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> { &self, path_str: &str, current_item: &Option, - module_id: syntax::ast::NodeId, + module_id: rustc_ast::ast::NodeId, ) -> Result<(Res, Option), ErrorKind> { let cx = self.cx; @@ -896,20 +896,20 @@ fn handle_variant( } const PRIMITIVES: &[(&str, Res)] = &[ - ("u8", Res::PrimTy(hir::PrimTy::Uint(syntax::ast::UintTy::U8))), - ("u16", Res::PrimTy(hir::PrimTy::Uint(syntax::ast::UintTy::U16))), - ("u32", Res::PrimTy(hir::PrimTy::Uint(syntax::ast::UintTy::U32))), - ("u64", Res::PrimTy(hir::PrimTy::Uint(syntax::ast::UintTy::U64))), - ("u128", Res::PrimTy(hir::PrimTy::Uint(syntax::ast::UintTy::U128))), - ("usize", Res::PrimTy(hir::PrimTy::Uint(syntax::ast::UintTy::Usize))), - ("i8", Res::PrimTy(hir::PrimTy::Int(syntax::ast::IntTy::I8))), - ("i16", Res::PrimTy(hir::PrimTy::Int(syntax::ast::IntTy::I16))), - ("i32", Res::PrimTy(hir::PrimTy::Int(syntax::ast::IntTy::I32))), - ("i64", Res::PrimTy(hir::PrimTy::Int(syntax::ast::IntTy::I64))), - ("i128", Res::PrimTy(hir::PrimTy::Int(syntax::ast::IntTy::I128))), - ("isize", Res::PrimTy(hir::PrimTy::Int(syntax::ast::IntTy::Isize))), - ("f32", Res::PrimTy(hir::PrimTy::Float(syntax::ast::FloatTy::F32))), - ("f64", Res::PrimTy(hir::PrimTy::Float(syntax::ast::FloatTy::F64))), + ("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))), ("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 4d51b63b740fd..b63dbbf80d864 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -1,6 +1,8 @@ use rustc::hir::map::Map; use rustc::session::{self, config, DiagnosticOutput}; use rustc::util::common::ErrorReported; +use rustc_ast::ast; +use rustc_ast::with_globals; use rustc_data_structures::sync::Lrc; use rustc_feature::UnstableFeatures; use rustc_hir as hir; @@ -17,8 +19,6 @@ use std::panic; use std::path::PathBuf; use std::process::{self, Command, Stdio}; use std::str; -use syntax::ast; -use syntax::with_globals; use tempfile::Builder as TempFileBuilder; use crate::clean::Attributes; @@ -387,7 +387,7 @@ pub fn make_test( prog.push_str(&crate_attrs); prog.push_str(&crates); - // Uses libsyntax to parse the doctest and find if there's a main fn and the extern + // Uses librustc_ast to parse the doctest and find if there's a main fn and the extern // crate already is included. let result = rustc_driver::catch_fatal_errors(|| { with_globals(edition, || { @@ -401,7 +401,7 @@ pub fn make_test( let source = crates + everything_else; // Any errors in parsing should also appear when the doctest is compiled for real, so just - // send all the errors that libsyntax emits directly into a `Sink` instead of stderr. + // send all the errors that librustc_ast emits directly into a `Sink` instead of stderr. let sm = Lrc::new(SourceMap::new(FilePathMapping::empty())); let emitter = EmitterWriter::new(box io::sink(), None, false, false, false, None, false); diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index d3d45ccccad36..8f2f88d08bf7a 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -3,6 +3,7 @@ use rustc::middle::privacy::AccessLevel; use rustc::ty::TyCtxt; +use rustc_ast::ast; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; @@ -12,7 +13,6 @@ use rustc_span::hygiene::MacroKind; use rustc_span::source_map::Spanned; use rustc_span::symbol::{kw, sym}; use rustc_span::{self, Span}; -use syntax::ast; use std::mem; diff --git a/src/libtest/cli.rs b/src/libtest/cli.rs index 778600b2196b7..a800bd17c503b 100644 --- a/src/libtest/cli.rs +++ b/src/libtest/cli.rs @@ -273,7 +273,7 @@ fn parse_opts_impl(matches: getopts::Matches) -> OptRes { Ok(test_opts) } -// FIXME: Copied from libsyntax until linkage errors are resolved. Issue #47566 +// FIXME: Copied from librustc_ast until linkage errors are resolved. Issue #47566 fn is_nightly() -> bool { // Whether this is a feature-staged build, i.e., on the beta or stable channel let disable_unstable_features = option_env!("CFG_DISABLE_UNSTABLE_FEATURES").is_some(); diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index de001cacbe195..b42e41cbfe6f0 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -13,7 +13,7 @@ // running tests while providing a base that other test frameworks may // build off of. -// N.B., this is also specified in this crate's Cargo.toml, but libsyntax contains logic specific to +// N.B., this is also specified in this crate's Cargo.toml, but librustc_ast contains logic specific to // this crate, which relies on this attribute (rather than the value of `--crate-name` passed by // cargo) to detect this crate. diff --git a/src/test/rustdoc/comment-in-doctest.rs b/src/test/rustdoc/comment-in-doctest.rs index e4e41bc7ce308..5691d173569a7 100644 --- a/src/test/rustdoc/comment-in-doctest.rs +++ b/src/test/rustdoc/comment-in-doctest.rs @@ -1,7 +1,7 @@ // compile-flags:--test // comments, both doc comments and regular ones, used to trick rustdoc's doctest parser into -// thinking that everything after it was part of the regular program. combined with the libsyntax +// thinking that everything after it was part of the regular program. combined with the librustc_ast // parser loop failing to detect the manual main function, it would wrap everything in `fn main`, // which would cause the doctest to fail as the "extern crate" declaration was no longer valid. // oddly enough, it would pass in 2018 if a crate was in the extern prelude. see diff --git a/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs b/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs index 91b3372e8f415..1b6a38acb1c30 100644 --- a/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs +++ b/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs @@ -9,7 +9,7 @@ extern crate rustc_lint; #[macro_use] extern crate rustc_session; extern crate rustc_span; -extern crate syntax; +extern crate rustc_ast; use rustc_ast_pretty::pprust; use rustc_driver::plugin::Registry; diff --git a/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs b/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs index eb251a0a3adb8..4936bdb1ece8c 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs @@ -9,12 +9,12 @@ extern crate rustc_span; extern crate rustc_lint; #[macro_use] extern crate rustc_session; -extern crate syntax; +extern crate rustc_ast; use rustc_driver::plugin::Registry; use rustc_lint::{LateContext, LateLintPass, LintContext, LintPass}; use rustc_span::symbol::Symbol; -use syntax::attr; +use rustc_ast::attr; macro_rules! fake_lint_pass { ($struct:ident, $($attr:expr),*) => { diff --git a/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs b/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs index e5f4bf88d57aa..32b7ed9dfe2c8 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs @@ -10,12 +10,12 @@ extern crate rustc_lint; #[macro_use] extern crate rustc_session; extern crate rustc_span; -extern crate syntax; +extern crate rustc_ast; use rustc_driver::plugin::Registry; use rustc_lint::{LateContext, LateLintPass, LintArray, LintContext, LintPass}; use rustc_span::symbol::Symbol; -use syntax::attr; +use rustc_ast::attr; declare_lint! { CRATE_NOT_OKAY, diff --git a/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs b/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs index ad5f882c43434..bb2a4d03734de 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs @@ -3,7 +3,7 @@ #![feature(plugin_registrar)] #![feature(box_syntax, rustc_private)] -extern crate syntax; +extern crate rustc_ast; // Load rustc as a plugin to get macros extern crate rustc_driver; @@ -14,7 +14,7 @@ extern crate rustc_session; use rustc_driver::plugin::Registry; use rustc_lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass}; -use syntax::ast; +use rustc_ast::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 b14dbdf8f938b..8c517e2bb5d54 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-tool-test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-tool-test.rs @@ -1,7 +1,7 @@ #![feature(plugin_registrar)] #![feature(box_syntax, rustc_private)] -extern crate syntax; +extern crate rustc_ast; // Load rustc as a plugin to get macros extern crate rustc_driver; @@ -12,7 +12,7 @@ extern crate rustc_session; use rustc_driver::plugin::Registry; use rustc_lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintId, LintPass}; -use syntax::ast; +use rustc_ast::ast; declare_tool_lint!(pub clippy::TEST_LINT, Warn, "Warn about stuff"); declare_tool_lint!( /// Some docs diff --git a/src/test/ui-fulldeps/auxiliary/macro-crate-test.rs b/src/test/ui-fulldeps/auxiliary/macro-crate-test.rs index fa136fd54c26b..56a560acbb44a 100644 --- a/src/test/ui-fulldeps/auxiliary/macro-crate-test.rs +++ b/src/test/ui-fulldeps/auxiliary/macro-crate-test.rs @@ -4,7 +4,7 @@ #![crate_type = "proc-macro"] #![feature(rustc_private)] -extern crate syntax; +extern crate rustc_ast; extern crate rustc; extern crate rustc_driver; extern crate proc_macro; diff --git a/src/test/ui-fulldeps/mod_dir_path_canonicalized.rs b/src/test/ui-fulldeps/mod_dir_path_canonicalized.rs index be4b49ada02c7..1046355a3433f 100644 --- a/src/test/ui-fulldeps/mod_dir_path_canonicalized.rs +++ b/src/test/ui-fulldeps/mod_dir_path_canonicalized.rs @@ -1,10 +1,10 @@ // run-pass -// Testing that a libsyntax can parse modules with canonicalized base path +// Testing that a librustc_ast can parse modules with canonicalized base path // ignore-cross-compile #![feature(rustc_private)] -extern crate syntax; +extern crate rustc_ast; extern crate rustc_parse; extern crate rustc_session; extern crate rustc_span; @@ -18,7 +18,7 @@ use std::path::Path; mod gravy; pub fn main() { - syntax::with_default_globals(|| parse()); + rustc_ast::with_default_globals(|| parse()); assert_eq!(gravy::foo(), 10); } diff --git a/src/test/ui-fulldeps/plugin-as-extern-crate.rs b/src/test/ui-fulldeps/plugin-as-extern-crate.rs index f231efc0a9a16..4d26e08d81e9b 100644 --- a/src/test/ui-fulldeps/plugin-as-extern-crate.rs +++ b/src/test/ui-fulldeps/plugin-as-extern-crate.rs @@ -3,7 +3,7 @@ // ignore-cross-compile // // empty_plugin will not compile on a cross-compiled target because -// libsyntax is not compiled for it. +// librustc_ast is not compiled for it. extern crate empty_plugin; // OK, plugin crates are still crates diff --git a/src/test/ui-fulldeps/pprust-expr-roundtrip.rs b/src/test/ui-fulldeps/pprust-expr-roundtrip.rs index 38576ef39d1d7..365ae301c0fb5 100644 --- a/src/test/ui-fulldeps/pprust-expr-roundtrip.rs +++ b/src/test/ui-fulldeps/pprust-expr-roundtrip.rs @@ -21,7 +21,7 @@ extern crate rustc_ast_pretty; extern crate rustc_data_structures; -extern crate syntax; +extern crate rustc_ast; extern crate rustc_parse; extern crate rustc_session; extern crate rustc_span; @@ -32,9 +32,9 @@ use rustc_parse::new_parser_from_source_str; use rustc_session::parse::ParseSess; use rustc_span::source_map::{Spanned, DUMMY_SP, FileName}; use rustc_span::source_map::FilePathMapping; -use syntax::ast::*; -use syntax::mut_visit::{self, MutVisitor, visit_clobber}; -use syntax::ptr::P; +use rustc_ast::ast::*; +use rustc_ast::mut_visit::{self, MutVisitor, visit_clobber}; +use rustc_ast::ptr::P; fn parse_expr(ps: &ParseSess, src: &str) -> Option> { let src_as_string = src.to_string(); @@ -205,7 +205,7 @@ impl MutVisitor for AddParens { } fn main() { - syntax::with_default_globals(|| run()); + rustc_ast::with_default_globals(|| run()); } fn run() { diff --git a/src/test/ui/issues/issue-22777.rs b/src/test/ui/issues/issue-22777.rs index a31f059408ff3..486683d12d604 100644 --- a/src/test/ui/issues/issue-22777.rs +++ b/src/test/ui/issues/issue-22777.rs @@ -1,5 +1,5 @@ // check-pass -// This test is reduced from libsyntax. It is just checking that we +// This test is reduced from librustc_ast. It is just checking that we // can successfully deal with a "deep" structure, which the drop-check // was hitting a recursion limit on at one point. diff --git a/src/test/ui/regions/regions-trait-object-1.rs b/src/test/ui/regions/regions-trait-object-1.rs index 679bf4dd8117c..e2520d978908d 100644 --- a/src/test/ui/regions/regions-trait-object-1.rs +++ b/src/test/ui/regions/regions-trait-object-1.rs @@ -1,7 +1,7 @@ // run-pass // This is a regression test for something that only came up while -// attempting to bootstrap libsyntax; it is adapted from -// `syntax::ext::tt::generic_extension`. +// attempting to bootstrap librustc_ast; it is adapted from +// `rustc_ast::ext::tt::generic_extension`. pub struct E<'a> { 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 5d1e00d2d3535..9c6be50c5c7bd 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(syntax::ast::DefId{krate: 0, node: 66}, +// Closure(rustc_ast::ast::DefId{krate: 0, node: 66}, // ReScope(63)) // // This is a regression test for issue #17021. diff --git a/src/tools/error_index_generator/main.rs b/src/tools/error_index_generator/main.rs index 313a303edb2bf..3335816f09f0e 100644 --- a/src/tools/error_index_generator/main.rs +++ b/src/tools/error_index_generator/main.rs @@ -2,8 +2,8 @@ #![deny(warnings)] extern crate env_logger; +extern crate rustc_ast; extern crate rustc_span; -extern crate syntax; use std::cell::RefCell; use std::collections::BTreeMap; @@ -285,7 +285,7 @@ fn parse_args() -> (OutputFormat, PathBuf) { fn main() { env_logger::init(); let (format, dst) = parse_args(); - let result = syntax::with_default_globals(move || main_with_result(format, &dst)); + let result = rustc_ast::with_default_globals(move || main_with_result(format, &dst)); if let Err(e) = result { panic!("{}", e.to_string()); } diff --git a/src/tools/tidy/src/pal.rs b/src/tools/tidy/src/pal.rs index dcd4c9e8ef7d9..f11394bd95f1f 100644 --- a/src/tools/tidy/src/pal.rs +++ b/src/tools/tidy/src/pal.rs @@ -76,7 +76,7 @@ const EXCEPTION_PATHS: &[&str] = &[ "src/tools", "src/librustc", "src/librustdoc", - "src/libsyntax", + "src/librustc_ast", "src/bootstrap", ];