about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-10-28 04:53:07 +0100
committerGitHub <noreply@github.com>2019-10-28 04:53:07 +0100
commit83260d5c4370679f145d5cebb471f91e81771ee2 (patch)
tree13e688558e3481acb9efbd6d8a217dc6f9deaa36
parent4728d66206c82c98aa4e1fad751e8aae7489c242 (diff)
parentfb12c708521d66b1f727ad4c1ec752a78799980d (diff)
downloadrust-83260d5c4370679f145d5cebb471f91e81771ee2.tar.gz
rust-83260d5c4370679f145d5cebb471f91e81771ee2.zip
Rollup merge of #65792 - Centril:split-syntax-2, r=petrochenkov
rustc, rustc_passes: reduce deps on rustc_expand

Part of #65324.

r? @petrochenkov
-rw-r--r--Cargo.lock3
-rw-r--r--src/librustc/Cargo.toml1
-rw-r--r--src/librustc/hir/def.rs2
-rw-r--r--src/librustc/hir/lowering.rs2
-rw-r--r--src/librustc/hir/lowering/item.rs2
-rw-r--r--src/librustc/hir/map/def_collector.rs2
-rw-r--r--src/librustc/hir/map/definitions.rs4
-rw-r--r--src/librustc/hir/map/mod.rs2
-rw-r--r--src/librustc/ich/hcx.rs3
-rw-r--r--src/librustc/ich/impls_syntax.rs2
-rw-r--r--src/librustc/lint/mod.rs2
-rw-r--r--src/librustc/session/mod.rs2
-rw-r--r--src/librustc/ty/mod.rs4
-rw-r--r--src/librustc_codegen_llvm/allocator.rs2
-rw-r--r--src/librustc_codegen_llvm/lib.rs3
-rw-r--r--src/librustc_codegen_ssa/Cargo.toml1
-rw-r--r--src/librustc_codegen_ssa/back/symbol_export.rs2
-rw-r--r--src/librustc_codegen_ssa/back/write.rs2
-rw-r--r--src/librustc_codegen_ssa/traits/backend.rs2
-rw-r--r--src/librustc_interface/passes.rs2
-rw-r--r--src/librustc_metadata/creader.rs2
-rw-r--r--src/librustc_metadata/decoder.rs8
-rw-r--r--src/librustc_metadata/encoder.rs2
-rw-r--r--src/librustc_passes/Cargo.toml1
-rw-r--r--src/librustc_passes/ast_validation.rs2
-rw-r--r--src/librustc_resolve/build_reduced_graph.rs7
-rw-r--r--src/librustc_resolve/diagnostics.rs2
-rw-r--r--src/librustc_resolve/late/diagnostics.rs2
-rw-r--r--src/librustc_resolve/lib.rs11
-rw-r--r--src/librustc_resolve/macros.rs13
-rw-r--r--src/librustc_resolve/resolve_imports.rs2
-rw-r--r--src/librustdoc/clean/inline.rs2
-rw-r--r--src/librustdoc/clean/mod.rs4
-rw-r--r--src/librustdoc/doctree.rs2
-rw-r--r--src/librustdoc/html/item_type.rs2
-rw-r--r--src/librustdoc/html/render.rs2
-rw-r--r--src/librustdoc/visit_ast.rs2
-rw-r--r--src/libsyntax/attr/mod.rs29
-rw-r--r--src/libsyntax/config.rs4
-rw-r--r--src/libsyntax/expand/allocator.rs (renamed from src/libsyntax_expand/allocator.rs)4
-rw-r--r--src/libsyntax/expand/mod.rs21
-rw-r--r--src/libsyntax/lib.rs4
-rw-r--r--src/libsyntax/parse/mod.rs21
-rw-r--r--src/libsyntax/parse/parser/path.rs2
-rw-r--r--src/libsyntax_expand/base.rs16
-rw-r--r--src/libsyntax_expand/lib.rs3
-rw-r--r--src/libsyntax_expand/proc_macro.rs14
-rw-r--r--src/libsyntax_ext/deriving/clone.rs3
-rw-r--r--src/libsyntax_ext/deriving/cmp/eq.rs3
-rw-r--r--src/libsyntax_ext/deriving/cmp/partial_eq.rs5
-rw-r--r--src/libsyntax_ext/deriving/generic/mod.rs5
-rw-r--r--src/libsyntax_ext/global_allocator.rs4
-rw-r--r--src/libsyntax_ext/proc_macro_harness.rs2
-rw-r--r--src/libsyntax_ext/standard_library_imports.rs2
54 files changed, 130 insertions, 123 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 64f3a7ac619..4b264ef3f9f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3135,7 +3135,6 @@ dependencies = [
  "serialize",
  "smallvec",
  "syntax",
- "syntax_expand",
  "syntax_pos",
 ]
 
@@ -3451,7 +3450,6 @@ dependencies = [
  "rustc_target",
  "serialize",
  "syntax",
- "syntax_expand",
  "syntax_pos",
  "tempfile",
 ]
@@ -3707,7 +3705,6 @@ dependencies = [
  "rustc_index",
  "rustc_target",
  "syntax",
- "syntax_expand",
  "syntax_pos",
 ]
 
diff --git a/src/librustc/Cargo.toml b/src/librustc/Cargo.toml
index 38631224fd3..9d26ff60017 100644
--- a/src/librustc/Cargo.toml
+++ b/src/librustc/Cargo.toml
@@ -29,7 +29,6 @@ rustc_index = { path = "../librustc_index" }
 errors = { path = "../librustc_errors", package = "rustc_errors" }
 rustc_serialize = { path = "../libserialize", package = "serialize" }
 syntax = { path = "../libsyntax" }
-syntax_expand = { path = "../libsyntax_expand" }
 syntax_pos = { path = "../libsyntax_pos" }
 backtrace = "0.3.3"
 parking_lot = "0.9"
diff --git a/src/librustc/hir/def.rs b/src/librustc/hir/def.rs
index a071a539e01..d4d7af92fe3 100644
--- a/src/librustc/hir/def.rs
+++ b/src/librustc/hir/def.rs
@@ -6,8 +6,8 @@ use crate::ty;
 use crate::util::nodemap::DefIdMap;
 
 use syntax::ast;
-use syntax_expand::base::MacroKind;
 use syntax::ast::NodeId;
+use syntax_pos::hygiene::MacroKind;
 use syntax_pos::Span;
 use rustc_macros::HashStable;
 
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index 002e6874466..12ab44515c3 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -64,7 +64,7 @@ use syntax::ast;
 use syntax::ptr::P as AstP;
 use syntax::ast::*;
 use syntax::errors;
-use syntax_expand::base::SpecialDerives;
+use syntax::expand::SpecialDerives;
 use syntax::print::pprust;
 use syntax::parse::token::{self, Nonterminal, Token};
 use syntax::tokenstream::{TokenStream, TokenTree};
diff --git a/src/librustc/hir/lowering/item.rs b/src/librustc/hir/lowering/item.rs
index 73d2ac5c134..9da87090c79 100644
--- a/src/librustc/hir/lowering/item.rs
+++ b/src/librustc/hir/lowering/item.rs
@@ -18,7 +18,7 @@ use smallvec::SmallVec;
 use syntax::attr;
 use syntax::ast::*;
 use syntax::visit::{self, Visitor};
-use syntax_expand::base::SpecialDerives;
+use syntax::expand::SpecialDerives;
 use syntax::source_map::{respan, DesugaringKind, Spanned};
 use syntax::symbol::{kw, sym};
 use syntax_pos::Span;
diff --git a/src/librustc/hir/map/def_collector.rs b/src/librustc/hir/map/def_collector.rs
index 7c8fdcc8b12..e9970e30bf9 100644
--- a/src/librustc/hir/map/def_collector.rs
+++ b/src/librustc/hir/map/def_collector.rs
@@ -2,10 +2,10 @@ use crate::hir::map::definitions::*;
 use crate::hir::def_id::DefIndex;
 
 use syntax::ast::*;
-use syntax_expand::hygiene::ExpnId;
 use syntax::visit;
 use syntax::symbol::{kw, sym};
 use syntax::parse::token::{self, Token};
+use syntax_pos::hygiene::ExpnId;
 use syntax_pos::Span;
 
 /// Creates `DefId`s for nodes in the AST.
diff --git a/src/librustc/hir/map/definitions.rs b/src/librustc/hir/map/definitions.rs
index 58e638e93ba..4e163314f6b 100644
--- a/src/librustc/hir/map/definitions.rs
+++ b/src/librustc/hir/map/definitions.rs
@@ -17,8 +17,8 @@ use std::borrow::Borrow;
 use std::fmt::Write;
 use std::hash::Hash;
 use syntax::ast;
-use syntax_expand::hygiene::ExpnId;
-use syntax::symbol::{Symbol, sym};
+use syntax_pos::symbol::{Symbol, sym};
+use syntax_pos::hygiene::ExpnId;
 use syntax_pos::{Span, DUMMY_SP};
 
 /// The `DefPathTable` maps `DefIndex`es to `DefKey`s and vice versa.
diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs
index f839087ec02..cd36944253d 100644
--- a/src/librustc/hir/map/mod.rs
+++ b/src/librustc/hir/map/mod.rs
@@ -20,7 +20,7 @@ use rustc_data_structures::svh::Svh;
 use rustc_index::vec::IndexVec;
 use syntax::ast::{self, Name, NodeId};
 use syntax::source_map::Spanned;
-use syntax_expand::base::MacroKind;
+use syntax_pos::hygiene::MacroKind;
 use syntax_pos::{Span, DUMMY_SP};
 
 pub mod blocks;
diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs
index 14d0673ecc0..957dab39414 100644
--- a/src/librustc/ich/hcx.rs
+++ b/src/librustc/ich/hcx.rs
@@ -13,11 +13,10 @@ use std::cell::RefCell;
 
 use syntax::ast;
 use syntax::source_map::SourceMap;
-use syntax_expand::hygiene::SyntaxContext;
 use syntax::symbol::Symbol;
 use syntax::tokenstream::DelimSpan;
 use syntax_pos::{Span, DUMMY_SP};
-use syntax_pos::hygiene;
+use syntax_pos::hygiene::{self, SyntaxContext};
 
 use rustc_data_structures::stable_hasher::{
     HashStable, StableHasher, ToStableHashKey,
diff --git a/src/librustc/ich/impls_syntax.rs b/src/librustc/ich/impls_syntax.rs
index 2510d7efb59..51aa79078f2 100644
--- a/src/librustc/ich/impls_syntax.rs
+++ b/src/librustc/ich/impls_syntax.rs
@@ -60,7 +60,7 @@ impl_stable_hash_for!(enum ::syntax::ast::AsmDialect {
     Intel
 });
 
-impl_stable_hash_for!(enum ::syntax_expand::base::MacroKind {
+impl_stable_hash_for!(enum ::syntax_pos::hygiene::MacroKind {
     Bang,
     Attr,
     Derive,
diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs
index 3c35bdae66e..4da146b1e5d 100644
--- a/src/librustc/lint/mod.rs
+++ b/src/librustc/lint/mod.rs
@@ -39,8 +39,8 @@ use syntax::ast;
 use syntax::source_map::{MultiSpan, ExpnKind, DesugaringKind};
 use syntax::early_buffered_lints::BufferedEarlyLintId;
 use syntax::edition::Edition;
-use syntax_expand::base::MacroKind;
 use syntax::symbol::{Symbol, sym};
+use syntax_pos::hygiene::MacroKind;
 use syntax_pos::Span;
 
 pub use crate::lint::context::{LateContext, EarlyContext, LintContext, LintStore,
diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs
index bd2460cfab1..8bf4765111d 100644
--- a/src/librustc/session/mod.rs
+++ b/src/librustc/session/mod.rs
@@ -24,7 +24,7 @@ use errors::emitter::HumanReadableErrorType;
 use errors::annotate_snippet_emitter_writer::{AnnotateSnippetEmitterWriter};
 use syntax::ast::{self, NodeId};
 use syntax::edition::Edition;
-use syntax_expand::allocator::AllocatorKind;
+use syntax::expand::allocator::AllocatorKind;
 use syntax::feature_gate::{self, AttributeType};
 use syntax::json::JsonEmitter;
 use syntax::source_map;
diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs
index eb673fcefcc..60028f2488a 100644
--- a/src/librustc/ty/mod.rs
+++ b/src/librustc/ty/mod.rs
@@ -46,8 +46,8 @@ use std::{mem, ptr};
 use std::ops::Range;
 use syntax::ast::{self, Name, Ident, NodeId};
 use syntax::attr;
-use syntax_expand::hygiene::ExpnId;
-use syntax::symbol::{kw, sym, Symbol};
+use syntax_pos::symbol::{kw, sym, Symbol};
+use syntax_pos::hygiene::ExpnId;
 use syntax_pos::Span;
 
 use smallvec;
diff --git a/src/librustc_codegen_llvm/allocator.rs b/src/librustc_codegen_llvm/allocator.rs
index 8c60c030eac..11b6e0befa1 100644
--- a/src/librustc_codegen_llvm/allocator.rs
+++ b/src/librustc_codegen_llvm/allocator.rs
@@ -3,7 +3,7 @@ use std::ffi::CString;
 use crate::attributes;
 use libc::c_uint;
 use rustc::ty::TyCtxt;
-use syntax_expand::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS};
+use syntax::expand::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS};
 
 use crate::ModuleLlvm;
 use crate::llvm::{self, False, True};
diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs
index e09b600afd4..2ad6c28cd08 100644
--- a/src/librustc_codegen_llvm/lib.rs
+++ b/src/librustc_codegen_llvm/lib.rs
@@ -39,7 +39,6 @@ extern crate rustc_driver as _;
 
 #[macro_use] extern crate log;
 extern crate syntax;
-extern crate syntax_expand;
 extern crate syntax_pos;
 extern crate rustc_errors as errors;
 
@@ -49,7 +48,7 @@ use rustc_codegen_ssa::back::lto::{SerializedModule, LtoModuleCodegen, ThinModul
 use rustc_codegen_ssa::CompiledModule;
 use errors::{FatalError, Handler};
 use rustc::dep_graph::WorkProduct;
-use syntax_expand::allocator::AllocatorKind;
+use syntax::expand::allocator::AllocatorKind;
 pub use llvm_util::target_features;
 use std::any::Any;
 use std::sync::Arc;
diff --git a/src/librustc_codegen_ssa/Cargo.toml b/src/librustc_codegen_ssa/Cargo.toml
index 6992f93d999..c7d09a423d5 100644
--- a/src/librustc_codegen_ssa/Cargo.toml
+++ b/src/librustc_codegen_ssa/Cargo.toml
@@ -21,7 +21,6 @@ tempfile = "3.1"
 
 rustc_serialize = { path = "../libserialize", package = "serialize" }
 syntax = { path = "../libsyntax" }
-syntax_expand = { path = "../libsyntax_expand" }
 syntax_pos = { path = "../libsyntax_pos" }
 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 d866a10f069..9443f225723 100644
--- a/src/librustc_codegen_ssa/back/symbol_export.rs
+++ b/src/librustc_codegen_ssa/back/symbol_export.rs
@@ -14,7 +14,7 @@ use rustc::ty::query::Providers;
 use rustc::ty::subst::SubstsRef;
 use rustc::util::nodemap::{FxHashMap, DefIdMap};
 use rustc_index::vec::IndexVec;
-use syntax_expand::allocator::ALLOCATOR_METHODS;
+use syntax::expand::allocator::ALLOCATOR_METHODS;
 
 pub type ExportedSymbols = FxHashMap<
     CrateNum,
diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs
index 762b50f1659..b302b9ae7f0 100644
--- a/src/librustc_codegen_ssa/back/write.rs
+++ b/src/librustc_codegen_ssa/back/write.rs
@@ -27,7 +27,7 @@ use rustc_errors::{Handler, Level, FatalError, DiagnosticId, SourceMapperDyn};
 use rustc_errors::emitter::{Emitter};
 use rustc_target::spec::MergeFunctions;
 use syntax::attr;
-use syntax_expand::hygiene::ExpnId;
+use syntax_pos::hygiene::ExpnId;
 use syntax_pos::symbol::{Symbol, sym};
 use jobserver::{Client, Acquired};
 
diff --git a/src/librustc_codegen_ssa/traits/backend.rs b/src/librustc_codegen_ssa/traits/backend.rs
index 1fff740d740..8ab8243afda 100644
--- a/src/librustc_codegen_ssa/traits/backend.rs
+++ b/src/librustc_codegen_ssa/traits/backend.rs
@@ -9,7 +9,7 @@ use rustc::ty::TyCtxt;
 use rustc_codegen_utils::codegen_backend::CodegenBackend;
 use std::sync::Arc;
 use std::sync::mpsc;
-use syntax_expand::allocator::AllocatorKind;
+use syntax::expand::allocator::AllocatorKind;
 use syntax_pos::symbol::Symbol;
 
 pub trait BackendTypes {
diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs
index 58936172c5b..b8593bd9199 100644
--- a/src/librustc_interface/passes.rs
+++ b/src/librustc_interface/passes.rs
@@ -502,7 +502,7 @@ pub fn lower_to_hir(
 
     // Discard hygiene data, which isn't required after lowering to HIR.
     if !sess.opts.debugging_opts.keep_hygiene_data {
-        syntax_expand::hygiene::clear_syntax_context_map();
+        syntax_pos::hygiene::clear_syntax_context_map();
     }
 
     Ok(hir_forest)
diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs
index f0a68058de8..234a5395047 100644
--- a/src/librustc_metadata/creader.rs
+++ b/src/librustc_metadata/creader.rs
@@ -25,7 +25,7 @@ use std::{cmp, fs};
 
 use syntax::ast;
 use syntax::attr;
-use syntax_expand::allocator::{global_allocator_spans, AllocatorKind};
+use syntax::expand::allocator::{global_allocator_spans, AllocatorKind};
 use syntax::symbol::{Symbol, sym};
 use syntax::span_fatal;
 use syntax_pos::{Span, DUMMY_SP};
diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs
index 09ff7891a9d..0e6ecbbf017 100644
--- a/src/librustc_metadata/decoder.rs
+++ b/src/librustc_metadata/decoder.rs
@@ -33,12 +33,12 @@ use rustc_serialize::{Decodable, Decoder, Encodable, SpecializedDecoder, opaque}
 use syntax::attr;
 use syntax::ast::{self, Ident};
 use syntax::source_map::{self, respan, Spanned};
-use syntax::symbol::{Symbol, sym};
-use syntax_expand::base::{MacroKind, SyntaxExtensionKind, SyntaxExtension};
-use syntax_pos::{self, Span, BytePos, Pos, DUMMY_SP};
+use syntax_expand::base::{SyntaxExtensionKind, SyntaxExtension};
+use syntax_expand::proc_macro::{AttrProcMacro, ProcMacroDerive, BangProcMacro};
+use syntax_pos::{self, Span, BytePos, Pos, DUMMY_SP, hygiene::MacroKind};
+use syntax_pos::symbol::{Symbol, sym};
 use log::debug;
 use proc_macro::bridge::client::ProcMacro;
-use syntax_expand::proc_macro::{AttrProcMacro, ProcMacroDerive, BangProcMacro};
 
 crate struct DecodeContext<'a, 'tcx> {
     opaque: opaque::Decoder<'a>,
diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs
index 08554c83ed5..f6498f4eaa8 100644
--- a/src/librustc_metadata/encoder.rs
+++ b/src/librustc_metadata/encoder.rs
@@ -32,7 +32,7 @@ use std::path::Path;
 use std::u32;
 use syntax::ast;
 use syntax::attr;
-use syntax_expand::proc_macro::is_proc_macro_attr;
+use syntax::expand::is_proc_macro_attr;
 use syntax::source_map::Spanned;
 use syntax::symbol::{kw, sym, Ident, Symbol};
 use syntax_pos::{self, FileName, SourceFile, Span};
diff --git a/src/librustc_passes/Cargo.toml b/src/librustc_passes/Cargo.toml
index 118deb560d6..9d29a230314 100644
--- a/src/librustc_passes/Cargo.toml
+++ b/src/librustc_passes/Cargo.toml
@@ -13,7 +13,6 @@ log = "0.4"
 rustc = { path = "../librustc" }
 rustc_data_structures = { path = "../librustc_data_structures" }
 syntax = { path = "../libsyntax" }
-syntax_expand = { path = "../libsyntax_expand" }
 syntax_pos = { path = "../libsyntax_pos" }
 errors = { path = "../librustc_errors", package = "rustc_errors" }
 rustc_target = { path = "../librustc_target" }
diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs
index 74de31263d3..994e9405fb6 100644
--- a/src/librustc_passes/ast_validation.rs
+++ b/src/librustc_passes/ast_validation.rs
@@ -14,7 +14,7 @@ use rustc::session::Session;
 use rustc_data_structures::fx::FxHashMap;
 use syntax::ast::*;
 use syntax::attr;
-use syntax_expand::proc_macro::is_proc_macro_attr;
+use syntax::expand::is_proc_macro_attr;
 use syntax::feature_gate::is_builtin_attr;
 use syntax::source_map::Spanned;
 use syntax::symbol::{kw, sym};
diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs
index c0fb8e33a81..d0725c7b802 100644
--- a/src/librustc_resolve/build_reduced_graph.rs
+++ b/src/librustc_resolve/build_reduced_graph.rs
@@ -32,9 +32,6 @@ use syntax::attr;
 
 use syntax::ast::{self, Block, ForeignItem, ForeignItemKind, Item, ItemKind, NodeId};
 use syntax::ast::{MetaItemKind, StmtKind, TraitItem, TraitItemKind};
-use syntax_expand::base::{MacroKind, SyntaxExtension};
-use syntax_expand::expand::AstFragment;
-use syntax_expand::hygiene::ExpnId;
 use syntax::feature_gate::is_builtin_attr;
 use syntax::parse::token::{self, Token};
 use syntax::print::pprust;
@@ -42,7 +39,9 @@ use syntax::{span_err, struct_span_err};
 use syntax::source_map::{respan, Spanned};
 use syntax::symbol::{kw, sym};
 use syntax::visit::{self, Visitor};
-
+use syntax_expand::base::SyntaxExtension;
+use syntax_expand::expand::AstFragment;
+use syntax_pos::hygiene::{MacroKind, ExpnId};
 use syntax_pos::{Span, DUMMY_SP};
 
 use log::debug;
diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs
index 7634093fbef..c0dfb7381ac 100644
--- a/src/librustc_resolve/diagnostics.rs
+++ b/src/librustc_resolve/diagnostics.rs
@@ -10,12 +10,12 @@ use rustc::session::Session;
 use rustc::ty::{self, DefIdTree};
 use rustc::util::nodemap::FxHashSet;
 use syntax::ast::{self, Ident, Path};
-use syntax_expand::base::MacroKind;
 use syntax::feature_gate::BUILTIN_ATTRIBUTES;
 use syntax::source_map::SourceMap;
 use syntax::struct_span_err;
 use syntax::symbol::{Symbol, kw};
 use syntax::util::lev_distance::find_best_match_for_name;
+use syntax_pos::hygiene::MacroKind;
 use syntax_pos::{BytePos, Span, MultiSpan};
 
 use crate::resolve_imports::{ImportDirective, ImportDirectiveSubclass, ImportResolver};
diff --git a/src/librustc_resolve/late/diagnostics.rs b/src/librustc_resolve/late/diagnostics.rs
index 07f44e0742e..3e896e373fb 100644
--- a/src/librustc_resolve/late/diagnostics.rs
+++ b/src/librustc_resolve/late/diagnostics.rs
@@ -13,9 +13,9 @@ use rustc::hir::PrimTy;
 use rustc::session::config::nightly_options;
 use rustc::util::nodemap::FxHashSet;
 use syntax::ast::{self, Expr, ExprKind, Ident, NodeId, Path, Ty, TyKind};
-use syntax_expand::base::MacroKind;
 use syntax::symbol::kw;
 use syntax::util::lev_distance::find_best_match_for_name;
+use syntax_pos::hygiene::MacroKind;
 use syntax_pos::Span;
 
 type Res = def::Res<ast::NodeId>;
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index 92392806347..cea205a8236 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -35,17 +35,18 @@ use rustc::span_bug;
 use rustc_metadata::creader::CrateLoader;
 use rustc_metadata::cstore::CStore;
 
-use syntax_expand::hygiene::{ExpnId, Transparency, SyntaxContext};
-use syntax_expand::base::{SyntaxExtension, MacroKind, SpecialDerives};
 use syntax::{struct_span_err, unwrap_or};
-use syntax::attr;
+use syntax::expand::SpecialDerives;
 use syntax::ast::{self, Name, NodeId, Ident, FloatTy, IntTy, UintTy};
-use syntax::ast::{ItemKind, Path, CRATE_NODE_ID, Crate};
+use syntax::ast::{CRATE_NODE_ID, Crate};
+use syntax::ast::{ItemKind, Path};
+use syntax::attr;
 use syntax::print::pprust;
 use syntax::symbol::{kw, sym};
 use syntax::source_map::Spanned;
 use syntax::visit::{self, Visitor};
-
+use syntax_expand::base::SyntaxExtension;
+use syntax_pos::hygiene::{MacroKind, ExpnId, Transparency, SyntaxContext};
 use syntax_pos::{Span, DUMMY_SP};
 use errors::{Applicability, DiagnosticBuilder};
 
diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs
index 94fe0cc5740..8b1b6db3ddc 100644
--- a/src/librustc_resolve/macros.rs
+++ b/src/librustc_resolve/macros.rs
@@ -14,20 +14,21 @@ use rustc::{ty, lint, span_bug};
 use syntax::ast::{self, NodeId, Ident};
 use syntax::attr::StabilityLevel;
 use syntax::edition::Edition;
-use syntax_expand::base::{self, InvocationRes, Indeterminate, SpecialDerives};
-use syntax_expand::base::{MacroKind, SyntaxExtension};
-use syntax_expand::expand::{AstFragment, AstFragmentKind, Invocation, InvocationKind};
-use syntax_expand::hygiene::{self, ExpnId, ExpnData, ExpnKind};
-use syntax_expand::compile_declarative_macro;
+use syntax::expand::SpecialDerives;
 use syntax::feature_gate::{emit_feature_err, is_builtin_attr_name};
 use syntax::feature_gate::GateIssue;
 use syntax::print::pprust;
 use syntax::symbol::{Symbol, kw, sym};
+use syntax_expand::base::{self, InvocationRes, Indeterminate};
+use syntax_expand::base::SyntaxExtension;
+use syntax_expand::expand::{AstFragment, AstFragmentKind, Invocation, InvocationKind};
+use syntax_expand::compile_declarative_macro;
+use syntax_pos::hygiene::{self, ExpnId, ExpnData, ExpnKind};
 use syntax_pos::{Span, DUMMY_SP};
 
 use std::{mem, ptr};
 use rustc_data_structures::sync::Lrc;
-use syntax_pos::hygiene::AstPass;
+use syntax_pos::hygiene::{MacroKind, AstPass};
 
 type Res = def::Res<NodeId>;
 
diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs
index 31340ddd683..c95009858e4 100644
--- a/src/librustc_resolve/resolve_imports.rs
+++ b/src/librustc_resolve/resolve_imports.rs
@@ -28,10 +28,10 @@ use rustc::util::nodemap::FxHashSet;
 use rustc::{bug, span_bug};
 
 use syntax::ast::{Ident, Name, NodeId, CRATE_NODE_ID};
-use syntax_expand::hygiene::ExpnId;
 use syntax::symbol::kw;
 use syntax::util::lev_distance::find_best_match_for_name;
 use syntax::{struct_span_err, unwrap_or};
+use syntax_pos::hygiene::ExpnId;
 use syntax_pos::{MultiSpan, Span};
 
 use log::*;
diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs
index a6a8fec429e..b3b3750320a 100644
--- a/src/librustdoc/clean/inline.rs
+++ b/src/librustdoc/clean/inline.rs
@@ -3,8 +3,8 @@
 use std::iter::once;
 
 use syntax::ast;
-use syntax_expand::base::MacroKind;
 use syntax::symbol::sym;
+use syntax_pos::hygiene::MacroKind;
 use syntax_pos::Span;
 
 use rustc::hir;
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index a642491b281..bdc02062230 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -28,10 +28,10 @@ use rustc::ty::layout::VariantIdx;
 use rustc::util::nodemap::{FxHashMap, FxHashSet};
 use syntax::ast::{self, Attribute, AttrStyle, AttrItem, Ident};
 use syntax::attr;
-use syntax_expand::base::MacroKind;
 use syntax::parse::lexer::comments;
 use syntax::source_map::DUMMY_SP;
-use syntax::symbol::{Symbol, kw, sym};
+use syntax_pos::symbol::{Symbol, kw, sym};
+use syntax_pos::hygiene::MacroKind;
 use syntax_pos::{self, Pos, FileName};
 
 use std::collections::hash_map::Entry;
diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs
index bbc00147ee1..002ca6fe983 100644
--- a/src/librustdoc/doctree.rs
+++ b/src/librustdoc/doctree.rs
@@ -4,7 +4,7 @@ pub use self::StructType::*;
 
 use syntax::ast;
 use syntax::ast::Name;
-use syntax_expand::base::MacroKind;
+use syntax_pos::hygiene::MacroKind;
 use syntax_pos::{self, Span};
 
 use rustc::hir;
diff --git a/src/librustdoc/html/item_type.rs b/src/librustdoc/html/item_type.rs
index e015739b03c..f5e45924893 100644
--- a/src/librustdoc/html/item_type.rs
+++ b/src/librustdoc/html/item_type.rs
@@ -1,7 +1,7 @@
 //! Item types.
 
 use std::fmt;
-use syntax_expand::base::MacroKind;
+use syntax_pos::hygiene::MacroKind;
 use crate::clean;
 
 /// Item type. Corresponds to `clean::ItemEnum` variants.
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 414c3137376..c4ee84d33f3 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -49,7 +49,7 @@ use syntax::feature_gate::UnstableFeatures;
 use syntax::print::pprust;
 use syntax::source_map::FileName;
 use syntax::symbol::{Symbol, sym};
-use syntax_expand::base::MacroKind;
+use syntax_pos::hygiene::MacroKind;
 use rustc::hir::def_id::DefId;
 use rustc::middle::privacy::AccessLevels;
 use rustc::middle::stability;
diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs
index 70c30687dab..5a83569f02a 100644
--- a/src/librustdoc/visit_ast.rs
+++ b/src/librustdoc/visit_ast.rs
@@ -8,9 +8,9 @@ use rustc::middle::privacy::AccessLevel;
 use rustc::util::nodemap::{FxHashSet, FxHashMap};
 use rustc::ty::TyCtxt;
 use syntax::ast;
-use syntax_expand::base::MacroKind;
 use syntax::source_map::Spanned;
 use syntax::symbol::sym;
+use syntax_pos::hygiene::MacroKind;
 use syntax_pos::{self, Span};
 
 use std::mem;
diff --git a/src/libsyntax/attr/mod.rs b/src/libsyntax/attr/mod.rs
index 27de084ae98..3e240a855e2 100644
--- a/src/libsyntax/attr/mod.rs
+++ b/src/libsyntax/attr/mod.rs
@@ -15,7 +15,7 @@ use crate::ast::{Lit, LitKind, Expr, Item, Local, Stmt, StmtKind, GenericParam};
 use crate::mut_visit::visit_clobber;
 use crate::source_map::{BytePos, Spanned};
 use crate::parse::lexer::comments::doc_comment_style;
-use crate::parse::parser::Parser;
+use crate::parse;
 use crate::parse::PResult;
 use crate::parse::token::{self, Token};
 use crate::ptr::P;
@@ -280,35 +280,10 @@ impl Attribute {
         self.item.meta(self.span)
     }
 
-    crate fn parse<'a, T, F>(&self, sess: &'a ParseSess, mut f: F) -> PResult<'a, T>
-        where F: FnMut(&mut Parser<'a>) -> PResult<'a, T>,
-    {
-        let mut parser = Parser::new(
-            sess,
-            self.tokens.clone(),
-            None,
-            false,
-            false,
-            Some("attribute"),
-        );
-        let result = f(&mut parser)?;
-        if parser.token != token::Eof {
-            parser.unexpected()?;
-        }
-        Ok(result)
-    }
-
-    pub fn parse_derive_paths<'a>(&self, sess: &'a ParseSess) -> PResult<'a, Vec<Path>> {
-        if self.tokens.is_empty() {
-            return Ok(Vec::new());
-        }
-        self.parse(sess, |p| p.parse_derive_paths())
-    }
-
     pub fn parse_meta<'a>(&self, sess: &'a ParseSess) -> PResult<'a, MetaItem> {
         Ok(MetaItem {
             path: self.path.clone(),
-            kind: self.parse(sess, |parser| parser.parse_meta_item_kind())?,
+            kind: parse::parse_in_attr(sess, self, |p| p.parse_meta_item_kind())?,
             span: self.span,
         })
     }
diff --git a/src/libsyntax/config.rs b/src/libsyntax/config.rs
index 54dc95291d6..6003fd1d286 100644
--- a/src/libsyntax/config.rs
+++ b/src/libsyntax/config.rs
@@ -10,6 +10,7 @@ use crate::attr;
 use crate::ast;
 use crate::edition::Edition;
 use crate::mut_visit::*;
+use crate::parse;
 use crate::ptr::P;
 use crate::sess::ParseSess;
 use crate::symbol::sym;
@@ -112,7 +113,8 @@ impl<'a> StripUnconfigured<'a> {
             return vec![];
         }
 
-        let (cfg_predicate, expanded_attrs) = match attr.parse(self.sess, |p| p.parse_cfg_attr()) {
+        let res = parse::parse_in_attr(self.sess, &attr, |p| p.parse_cfg_attr());
+        let (cfg_predicate, expanded_attrs) = match res {
             Ok(result) => result,
             Err(mut e) => {
                 e.emit();
diff --git a/src/libsyntax_expand/allocator.rs b/src/libsyntax/expand/allocator.rs
index 3526be17721..20487b9af03 100644
--- a/src/libsyntax_expand/allocator.rs
+++ b/src/libsyntax/expand/allocator.rs
@@ -1,5 +1,5 @@
-use syntax::{ast, attr, visit};
-use syntax::symbol::{sym, Symbol};
+use crate::{ast, attr, visit};
+use syntax_pos::symbol::{sym, Symbol};
 use syntax_pos::Span;
 
 #[derive(Clone, Copy)]
diff --git a/src/libsyntax/expand/mod.rs b/src/libsyntax/expand/mod.rs
new file mode 100644
index 00000000000..038f60287be
--- /dev/null
+++ b/src/libsyntax/expand/mod.rs
@@ -0,0 +1,21 @@
+//! Definitions shared by macros / syntax extensions and e.g. librustc.
+
+use crate::ast::Attribute;
+use syntax_pos::symbol::sym;
+
+pub mod allocator;
+
+bitflags::bitflags! {
+    /// Built-in derives that need some extra tracking beyond the usual macro functionality.
+    #[derive(Default)]
+    pub struct SpecialDerives: u8 {
+        const PARTIAL_EQ = 1 << 0;
+        const EQ         = 1 << 1;
+        const COPY       = 1 << 2;
+    }
+}
+
+pub fn is_proc_macro_attr(attr: &Attribute) -> bool {
+    [sym::proc_macro, sym::proc_macro_attribute, sym::proc_macro_derive]
+        .iter().any(|kind| attr.check_name(*kind))
+}
diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs
index 3a2af96f7db..7be6e6c7e18 100644
--- a/src/libsyntax/lib.rs
+++ b/src/libsyntax/lib.rs
@@ -95,9 +95,9 @@ pub mod json;
 
 pub mod ast;
 pub mod attr;
+pub mod expand;
 pub mod source_map;
-#[macro_use]
-pub mod config;
+#[macro_use] pub mod config;
 pub mod entry;
 pub mod feature_gate;
 pub mod mut_visit;
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index e6ddf8778cc..f5e416b722b 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -288,6 +288,27 @@ pub fn stream_to_parser_with_base_dir<'a>(
     Parser::new(sess, stream, Some(base_dir), true, false, None)
 }
 
+/// Runs the given subparser `f` on the tokens of the given `attr`'s item.
+pub fn parse_in_attr<'a, T>(
+    sess: &'a ParseSess,
+    attr: &ast::Attribute,
+    mut f: impl FnMut(&mut Parser<'a>) -> PResult<'a, T>,
+) -> PResult<'a, T> {
+    let mut parser = Parser::new(
+        sess,
+        attr.tokens.clone(),
+        None,
+        false,
+        false,
+        Some("attribute"),
+    );
+    let result = f(&mut parser)?;
+    if parser.token != token::Eof {
+        parser.unexpected()?;
+    }
+    Ok(result)
+}
+
 // NOTE(Centril): The following probably shouldn't be here but it acknowledges the
 // fact that architecturally, we are using parsing (read on below to understand why).
 
diff --git a/src/libsyntax/parse/parser/path.rs b/src/libsyntax/parse/parser/path.rs
index 77709a22953..38a28224dab 100644
--- a/src/libsyntax/parse/parser/path.rs
+++ b/src/libsyntax/parse/parser/path.rs
@@ -130,7 +130,7 @@ impl<'a> Parser<'a> {
     }
 
     /// Parse a list of paths inside `#[derive(path_0, ..., path_n)]`.
-    crate fn parse_derive_paths(&mut self) -> PResult<'a, Vec<Path>> {
+    pub fn parse_derive_paths(&mut self) -> PResult<'a, Vec<Path>> {
         self.expect(&token::OpenDelim(token::Paren))?;
         let mut list = Vec::new();
         while !self.eat(&token::CloseDelim(token::Paren)) {
diff --git a/src/libsyntax_expand/base.rs b/src/libsyntax_expand/base.rs
index 58edf23a5b1..a66263a9a02 100644
--- a/src/libsyntax_expand/base.rs
+++ b/src/libsyntax_expand/base.rs
@@ -1,5 +1,4 @@
 use crate::expand::{self, AstFragment, Invocation};
-use crate::hygiene::ExpnId;
 
 use syntax::ast::{self, NodeId, Attribute, Name, PatKind};
 use syntax::attr::{self, HasAttrs, Stability, Deprecation};
@@ -14,11 +13,12 @@ use syntax::symbol::{kw, sym, Ident, Symbol};
 use syntax::{ThinVec, MACRO_ARGUMENTS};
 use syntax::tokenstream::{self, TokenStream};
 use syntax::visit::Visitor;
+crate use syntax::expand::SpecialDerives;
 
 use errors::{DiagnosticBuilder, DiagnosticId};
 use smallvec::{smallvec, SmallVec};
 use syntax_pos::{FileName, Span, MultiSpan, DUMMY_SP};
-use syntax_pos::hygiene::{AstPass, ExpnData, ExpnKind};
+use syntax_pos::hygiene::{AstPass, ExpnId, ExpnData, ExpnKind};
 
 use rustc_data_structures::fx::FxHashMap;
 use rustc_data_structures::sync::{self, Lrc};
@@ -27,7 +27,7 @@ use std::path::PathBuf;
 use std::rc::Rc;
 use std::default::Default;
 
-pub use syntax_pos::hygiene::MacroKind;
+crate use syntax_pos::hygiene::MacroKind;
 
 #[derive(Debug,Clone)]
 pub enum Annotatable {
@@ -837,16 +837,6 @@ pub enum InvocationRes {
 /// Error type that denotes indeterminacy.
 pub struct Indeterminate;
 
-bitflags::bitflags! {
-    /// Built-in derives that need some extra tracking beyond the usual macro functionality.
-    #[derive(Default)]
-    pub struct SpecialDerives: u8 {
-        const PARTIAL_EQ = 1 << 0;
-        const EQ         = 1 << 1;
-        const COPY       = 1 << 2;
-    }
-}
-
 pub trait Resolver {
     fn next_node_id(&mut self) -> NodeId;
 
diff --git a/src/libsyntax_expand/lib.rs b/src/libsyntax_expand/lib.rs
index db292b619be..10eb3ecb20b 100644
--- a/src/libsyntax_expand/lib.rs
+++ b/src/libsyntax_expand/lib.rs
@@ -28,9 +28,8 @@ macro_rules! panictry {
 mod placeholders;
 mod proc_macro_server;
 
-pub use syntax_pos::hygiene;
+crate use syntax_pos::hygiene;
 pub use mbe::macro_rules::compile_declarative_macro;
-pub mod allocator;
 pub mod base;
 pub mod build;
 pub mod expand;
diff --git a/src/libsyntax_expand/proc_macro.rs b/src/libsyntax_expand/proc_macro.rs
index 07b618c99a5..bda9478ce96 100644
--- a/src/libsyntax_expand/proc_macro.rs
+++ b/src/libsyntax_expand/proc_macro.rs
@@ -178,11 +178,6 @@ impl<'a> Visitor<'a> for MarkAttrs<'a> {
     fn visit_mac(&mut self, _mac: &Mac) {}
 }
 
-pub fn is_proc_macro_attr(attr: &Attribute) -> bool {
-    [sym::proc_macro, sym::proc_macro_attribute, sym::proc_macro_derive]
-        .iter().any(|kind| attr.check_name(*kind))
-}
-
 crate fn collect_derives(cx: &mut ExtCtxt<'_>, attrs: &mut Vec<ast::Attribute>) -> Vec<ast::Path> {
     let mut result = Vec::new();
     attrs.retain(|attr| {
@@ -200,7 +195,14 @@ crate fn collect_derives(cx: &mut ExtCtxt<'_>, attrs: &mut Vec<ast::Attribute>)
             return false;
         }
 
-        match attr.parse_derive_paths(cx.parse_sess) {
+        let parse_derive_paths = |attr: &ast::Attribute| {
+            if attr.tokens.is_empty() {
+                return Ok(Vec::new());
+            }
+            parse::parse_in_attr(cx.parse_sess, attr, |p| p.parse_derive_paths())
+        };
+
+        match parse_derive_paths(attr) {
             Ok(traits) => {
                 result.extend(traits);
                 true
diff --git a/src/libsyntax_ext/deriving/clone.rs b/src/libsyntax_ext/deriving/clone.rs
index 67ef69babdc..061afa379c6 100644
--- a/src/libsyntax_ext/deriving/clone.rs
+++ b/src/libsyntax_ext/deriving/clone.rs
@@ -3,7 +3,8 @@ use crate::deriving::generic::*;
 use crate::deriving::generic::ty::*;
 
 use syntax::ast::{self, Expr, GenericArg, Generics, ItemKind, MetaItem, VariantData};
-use syntax_expand::base::{Annotatable, ExtCtxt, SpecialDerives};
+use syntax::expand::SpecialDerives;
+use syntax_expand::base::{Annotatable, ExtCtxt};
 use syntax::ptr::P;
 use syntax::symbol::{kw, sym, Symbol};
 use syntax_pos::Span;
diff --git a/src/libsyntax_ext/deriving/cmp/eq.rs b/src/libsyntax_ext/deriving/cmp/eq.rs
index 162aaedafea..eddf8eea1db 100644
--- a/src/libsyntax_ext/deriving/cmp/eq.rs
+++ b/src/libsyntax_ext/deriving/cmp/eq.rs
@@ -3,9 +3,10 @@ use crate::deriving::generic::*;
 use crate::deriving::generic::ty::*;
 
 use syntax::ast::{self, Ident, Expr, MetaItem, GenericArg};
-use syntax_expand::base::{Annotatable, ExtCtxt, SpecialDerives};
+use syntax::expand::SpecialDerives;
 use syntax::ptr::P;
 use syntax::symbol::{sym, Symbol};
+use syntax_expand::base::{Annotatable, ExtCtxt};
 use syntax_pos::Span;
 
 pub fn expand_deriving_eq(cx: &mut ExtCtxt<'_>,
diff --git a/src/libsyntax_ext/deriving/cmp/partial_eq.rs b/src/libsyntax_ext/deriving/cmp/partial_eq.rs
index c3e2b78bbe5..2e2be91de8a 100644
--- a/src/libsyntax_ext/deriving/cmp/partial_eq.rs
+++ b/src/libsyntax_ext/deriving/cmp/partial_eq.rs
@@ -3,10 +3,11 @@ use crate::deriving::generic::*;
 use crate::deriving::generic::ty::*;
 
 use syntax::ast::{BinOpKind, Expr, MetaItem};
-use syntax_expand::base::{Annotatable, ExtCtxt, SpecialDerives};
+use syntax::expand::SpecialDerives;
 use syntax::ptr::P;
 use syntax::symbol::sym;
-use syntax_pos::{self, Span};
+use syntax_expand::base::{Annotatable, ExtCtxt};
+use syntax_pos::Span;
 
 pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt<'_>,
                                   span: Span,
diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs
index 216338c1a88..c04b65245e1 100644
--- a/src/libsyntax_ext/deriving/generic/mod.rs
+++ b/src/libsyntax_ext/deriving/generic/mod.rs
@@ -186,13 +186,14 @@ use rustc_target::spec::abi::Abi;
 use syntax::ast::{self, BinOpKind, EnumDef, Expr, Generics, Ident, PatKind};
 use syntax::ast::{VariantData, GenericParamKind, GenericArg};
 use syntax::attr;
+use syntax::expand::SpecialDerives;
 use syntax::source_map::respan;
 use syntax::util::map_in_place::MapInPlace;
 use syntax::ptr::P;
 use syntax::sess::ParseSess;
 use syntax::symbol::{Symbol, kw, sym};
-use syntax_expand::base::{Annotatable, ExtCtxt, SpecialDerives};
-use syntax_pos::{Span};
+use syntax_expand::base::{Annotatable, ExtCtxt};
+use syntax_pos::Span;
 
 use ty::{LifetimeBounds, Path, Ptr, PtrTy, Self_, Ty};
 
diff --git a/src/libsyntax_ext/global_allocator.rs b/src/libsyntax_ext/global_allocator.rs
index 75dda9535b3..90d2ea38bc3 100644
--- a/src/libsyntax_ext/global_allocator.rs
+++ b/src/libsyntax_ext/global_allocator.rs
@@ -2,10 +2,10 @@ use crate::util::check_builtin_macro_attribute;
 
 use syntax::ast::{ItemKind, Mutability, Stmt, Ty, TyKind, Unsafety};
 use syntax::ast::{self, Param, Attribute, Expr, FnHeader, Generics, Ident};
-use syntax_expand::allocator::{AllocatorKind, AllocatorMethod, AllocatorTy, ALLOCATOR_METHODS};
-use syntax_expand::base::{Annotatable, ExtCtxt};
+use syntax::expand::allocator::{AllocatorKind, AllocatorMethod, AllocatorTy, ALLOCATOR_METHODS};
 use syntax::ptr::P;
 use syntax::symbol::{kw, sym, Symbol};
+use syntax_expand::base::{Annotatable, ExtCtxt};
 use syntax_pos::Span;
 
 pub fn expand(
diff --git a/src/libsyntax_ext/proc_macro_harness.rs b/src/libsyntax_ext/proc_macro_harness.rs
index c874f1ffb11..fc4a7a0a0fe 100644
--- a/src/libsyntax_ext/proc_macro_harness.rs
+++ b/src/libsyntax_ext/proc_macro_harness.rs
@@ -3,6 +3,7 @@ use std::mem;
 use smallvec::smallvec;
 use syntax::ast::{self, Ident};
 use syntax::attr;
+use syntax::expand::is_proc_macro_attr;
 use syntax::print::pprust;
 use syntax::ptr::P;
 use syntax::sess::ParseSess;
@@ -10,7 +11,6 @@ use syntax::symbol::{kw, sym};
 use syntax::visit::{self, Visitor};
 use syntax_expand::base::{ExtCtxt, Resolver};
 use syntax_expand::expand::{AstFragment, ExpansionConfig};
-use syntax_expand::proc_macro::is_proc_macro_attr;
 use syntax_pos::{Span, DUMMY_SP};
 use syntax_pos::hygiene::AstPass;
 
diff --git a/src/libsyntax_ext/standard_library_imports.rs b/src/libsyntax_ext/standard_library_imports.rs
index fd27a218906..6514ff5e252 100644
--- a/src/libsyntax_ext/standard_library_imports.rs
+++ b/src/libsyntax_ext/standard_library_imports.rs
@@ -4,9 +4,9 @@ use syntax::ptr::P;
 use syntax::sess::ParseSess;
 use syntax::symbol::{Ident, Symbol, kw, sym};
 use syntax_expand::expand::ExpansionConfig;
-use syntax_expand::hygiene::AstPass;
 use syntax_expand::base::{ExtCtxt, Resolver};
 use syntax_pos::DUMMY_SP;
+use syntax_pos::hygiene::AstPass;
 
 pub fn inject(
     mut krate: ast::Crate,