diff --git a/Cargo.lock b/Cargo.lock index b90bcfc7f2f44..8a76ffcbe7249 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1099,7 +1099,7 @@ name = "fmt_macros" version = "0.0.0" dependencies = [ "rustc_lexer", - "syntax_pos", + "rustc_span", ] [[package]] @@ -3094,12 +3094,12 @@ dependencies = [ "rustc_index", "rustc_macros", "rustc_session", + "rustc_span", "rustc_target", "scoped-tls", "serialize", "smallvec 1.0.0", "syntax", - "syntax_pos", ] [[package]] @@ -3358,6 +3358,24 @@ dependencies = [ "core", ] +[[package]] +name = "rustc_builtin_macros" +version = "0.0.0" +dependencies = [ + "fmt_macros", + "log", + "rustc_data_structures", + "rustc_error_codes", + "rustc_errors", + "rustc_expand", + "rustc_feature", + "rustc_parse", + "rustc_span", + "rustc_target", + "smallvec 1.0.0", + "syntax", +] + [[package]] name = "rustc_codegen_llvm" version = "0.0.0" @@ -3372,17 +3390,17 @@ dependencies = [ "rustc_codegen_utils", "rustc_data_structures", "rustc_errors", + "rustc_expand", "rustc_feature", "rustc_fs_util", "rustc_incremental", "rustc_index", "rustc_llvm", "rustc_session", + "rustc_span", "rustc_target", "smallvec 0.6.10", "syntax", - "syntax_expand", - "syntax_pos", ] [[package]] @@ -3406,10 +3424,10 @@ dependencies = [ "rustc_incremental", "rustc_index", "rustc_session", + "rustc_span", "rustc_target", "serialize", "syntax", - "syntax_pos", "tempfile", ] @@ -3423,9 +3441,9 @@ dependencies = [ "rustc-demangle", "rustc_data_structures", "rustc_metadata", + "rustc_span", "rustc_target", "syntax", - "syntax_pos", ] [[package]] @@ -3474,10 +3492,10 @@ dependencies = [ "rustc_plugin_impl", "rustc_resolve", "rustc_save_analysis", + "rustc_span", "rustc_target", "serialize", "syntax", - "syntax_pos", ] [[package]] @@ -3492,20 +3510,36 @@ dependencies = [ "atty", "log", "rustc_data_structures", + "rustc_span", "serialize", - "syntax_pos", "term_size", "termcolor", "unicode-width", ] +[[package]] +name = "rustc_expand" +version = "0.0.0" +dependencies = [ + "log", + "rustc_data_structures", + "rustc_errors", + "rustc_feature", + "rustc_lexer", + "rustc_parse", + "rustc_span", + "serialize", + "smallvec 1.0.0", + "syntax", +] + [[package]] name = "rustc_feature" version = "0.0.0" dependencies = [ "lazy_static 1.3.0", "rustc_data_structures", - "syntax_pos", + "rustc_span", ] [[package]] @@ -3523,9 +3557,9 @@ dependencies = [ "rustc_data_structures", "rustc_fs_util", "rustc_session", + "rustc_span", "serialize", "syntax", - "syntax_pos", ] [[package]] @@ -3544,11 +3578,13 @@ dependencies = [ "once_cell", "rustc", "rustc-rayon", + "rustc_builtin_macros", "rustc_codegen_llvm", "rustc_codegen_ssa", "rustc_codegen_utils", "rustc_data_structures", "rustc_errors", + "rustc_expand", "rustc_incremental", "rustc_lint", "rustc_metadata", @@ -3558,15 +3594,13 @@ dependencies = [ "rustc_plugin_impl", "rustc_privacy", "rustc_resolve", + "rustc_span", "rustc_target", "rustc_traits", "rustc_typeck", "serialize", "smallvec 1.0.0", "syntax", - "syntax_expand", - "syntax_ext", - "syntax_pos", "tempfile", ] @@ -3588,9 +3622,9 @@ dependencies = [ "rustc_feature", "rustc_index", "rustc_session", + "rustc_span", "rustc_target", "syntax", - "syntax_pos", ] [[package]] @@ -3635,15 +3669,15 @@ dependencies = [ "rustc_data_structures", "rustc_error_codes", "rustc_errors", + "rustc_expand", "rustc_index", "rustc_parse", + "rustc_span", "rustc_target", "serialize", "smallvec 1.0.0", "stable_deref_trait", "syntax", - "syntax_expand", - "syntax_pos", ] [[package]] @@ -3665,11 +3699,11 @@ dependencies = [ "rustc_index", "rustc_lexer", "rustc_macros", + "rustc_span", "rustc_target", "serialize", "smallvec 1.0.0", "syntax", - "syntax_pos", ] [[package]] @@ -3694,9 +3728,9 @@ dependencies = [ "rustc_errors", "rustc_feature", "rustc_lexer", + "rustc_span", "smallvec 1.0.0", "syntax", - "syntax_pos", "unicode-normalization", ] @@ -3712,9 +3746,9 @@ dependencies = [ "rustc_feature", "rustc_index", "rustc_parse", + "rustc_span", "rustc_target", "syntax", - "syntax_pos", ] [[package]] @@ -3724,8 +3758,8 @@ dependencies = [ "rustc", "rustc_error_codes", "rustc_metadata", + "rustc_span", "syntax", - "syntax_pos", ] [[package]] @@ -3736,9 +3770,9 @@ dependencies = [ "rustc", "rustc_data_structures", "rustc_error_codes", + "rustc_span", "rustc_typeck", "syntax", - "syntax_pos", ] [[package]] @@ -3752,12 +3786,12 @@ dependencies = [ "rustc_data_structures", "rustc_error_codes", "rustc_errors", + "rustc_expand", "rustc_feature", "rustc_metadata", + "rustc_span", "smallvec 1.0.0", "syntax", - "syntax_expand", - "syntax_pos", ] [[package]] @@ -3771,9 +3805,9 @@ dependencies = [ "rustc_codegen_utils", "rustc_data_structures", "rustc_parse", + "rustc_span", "serde_json", "syntax", - "syntax_pos", ] [[package]] @@ -3787,9 +3821,24 @@ dependencies = [ "rustc_feature", "rustc_fs_util", "rustc_index", + "rustc_span", "rustc_target", "serialize", - "syntax_pos", +] + +[[package]] +name = "rustc_span" +version = "0.0.0" +dependencies = [ + "arena", + "cfg-if", + "log", + "rustc_data_structures", + "rustc_index", + "rustc_macros", + "scoped-tls", + "serialize", + "unicode-width", ] [[package]] @@ -3801,8 +3850,8 @@ dependencies = [ "rustc_data_structures", "rustc_index", "rustc_macros", + "rustc_span", "serialize", - "syntax_pos", ] [[package]] @@ -3824,10 +3873,10 @@ dependencies = [ "rustc", "rustc_data_structures", "rustc_macros", + "rustc_span", "rustc_target", "smallvec 1.0.0", "syntax", - "syntax_pos", ] [[package]] @@ -3852,10 +3901,10 @@ dependencies = [ "rustc_error_codes", "rustc_errors", "rustc_index", + "rustc_span", "rustc_target", "smallvec 1.0.0", "syntax", - "syntax_pos", ] [[package]] @@ -4369,59 +4418,10 @@ dependencies = [ "rustc_lexer", "rustc_macros", "rustc_session", + "rustc_span", "scoped-tls", "serialize", "smallvec 1.0.0", - "syntax_pos", -] - -[[package]] -name = "syntax_expand" -version = "0.0.0" -dependencies = [ - "log", - "rustc_data_structures", - "rustc_errors", - "rustc_feature", - "rustc_lexer", - "rustc_parse", - "serialize", - "smallvec 1.0.0", - "syntax", - "syntax_pos", -] - -[[package]] -name = "syntax_ext" -version = "0.0.0" -dependencies = [ - "fmt_macros", - "log", - "rustc_data_structures", - "rustc_error_codes", - "rustc_errors", - "rustc_feature", - "rustc_parse", - "rustc_target", - "smallvec 1.0.0", - "syntax", - "syntax_expand", - "syntax_pos", -] - -[[package]] -name = "syntax_pos" -version = "0.0.0" -dependencies = [ - "arena", - "cfg-if", - "log", - "rustc_data_structures", - "rustc_index", - "rustc_macros", - "scoped-tls", - "serialize", - "unicode-width", ] [[package]] diff --git a/src/libfmt_macros/Cargo.toml b/src/libfmt_macros/Cargo.toml index fff4ec716dfda..70752b548ddb3 100644 --- a/src/libfmt_macros/Cargo.toml +++ b/src/libfmt_macros/Cargo.toml @@ -9,5 +9,5 @@ name = "fmt_macros" path = "lib.rs" [dependencies] -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } rustc_lexer = { path = "../librustc_lexer" } diff --git a/src/librustc/Cargo.toml b/src/librustc/Cargo.toml index a4536bb6c41f0..19122424d6ddd 100644 --- a/src/librustc/Cargo.toml +++ b/src/librustc/Cargo.toml @@ -30,7 +30,7 @@ rustc_index = { path = "../librustc_index" } errors = { path = "../librustc_errors", package = "rustc_errors" } rustc_serialize = { path = "../libserialize", package = "serialize" } syntax = { path = "../libsyntax" } -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } backtrace = "0.3.40" parking_lot = "0.9" byteorder = { version = "1.3" } diff --git a/src/libsyntax_ext/Cargo.toml b/src/librustc_builtin_macros/Cargo.toml similarity index 78% rename from src/libsyntax_ext/Cargo.toml rename to src/librustc_builtin_macros/Cargo.toml index d73a9ea6cdbc1..d2834bf7022fe 100644 --- a/src/libsyntax_ext/Cargo.toml +++ b/src/librustc_builtin_macros/Cargo.toml @@ -1,11 +1,11 @@ [package] authors = ["The Rust Project Developers"] -name = "syntax_ext" +name = "rustc_builtin_macros" version = "0.0.0" edition = "2018" [lib] -name = "syntax_ext" +name = "rustc_builtin_macros" path = "lib.rs" doctest = false @@ -19,6 +19,6 @@ rustc_parse = { path = "../librustc_parse" } rustc_target = { path = "../librustc_target" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } syntax = { path = "../libsyntax" } -syntax_expand = { path = "../libsyntax_expand" } -syntax_pos = { path = "../libsyntax_pos" } +rustc_expand = { path = "../librustc_expand" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } rustc_error_codes = { path = "../librustc_error_codes" } diff --git a/src/libsyntax_ext/asm.rs b/src/librustc_builtin_macros/asm.rs similarity index 99% rename from src/libsyntax_ext/asm.rs rename to src/librustc_builtin_macros/asm.rs index 324bef9cbb843..0e1ff7603ba74 100644 --- a/src/libsyntax_ext/asm.rs +++ b/src/librustc_builtin_macros/asm.rs @@ -3,6 +3,7 @@ use State::*; use errors::{DiagnosticBuilder, PResult}; +use rustc_expand::base::*; use rustc_parse::parser::Parser; use syntax::ast::{self, AsmDialect}; use syntax::ptr::P; @@ -10,7 +11,6 @@ use syntax::symbol::{kw, sym, Symbol}; use syntax::token::{self, Token}; use syntax::tokenstream::{self, TokenStream}; use syntax::{span_err, struct_span_err}; -use syntax_expand::base::*; use syntax_pos::Span; use rustc_error_codes::*; diff --git a/src/libsyntax_ext/assert.rs b/src/librustc_builtin_macros/assert.rs similarity index 99% rename from src/libsyntax_ext/assert.rs rename to src/librustc_builtin_macros/assert.rs index 331e9fa61d03b..59e499b8f8ee4 100644 --- a/src/libsyntax_ext/assert.rs +++ b/src/librustc_builtin_macros/assert.rs @@ -1,5 +1,6 @@ use errors::{Applicability, DiagnosticBuilder}; +use rustc_expand::base::*; use rustc_parse::parser::Parser; use syntax::ast::{self, *}; use syntax::print::pprust; @@ -7,7 +8,6 @@ use syntax::ptr::P; use syntax::symbol::{sym, Symbol}; use syntax::token::{self, TokenKind}; use syntax::tokenstream::{DelimSpan, TokenStream, TokenTree}; -use syntax_expand::base::*; use syntax_pos::{Span, DUMMY_SP}; pub fn expand_assert<'cx>( diff --git a/src/libsyntax_ext/cfg.rs b/src/librustc_builtin_macros/cfg.rs similarity index 97% rename from src/libsyntax_ext/cfg.rs rename to src/librustc_builtin_macros/cfg.rs index 7b1dbcc7762b6..6d97b94ab9f9f 100644 --- a/src/libsyntax_ext/cfg.rs +++ b/src/librustc_builtin_macros/cfg.rs @@ -3,11 +3,11 @@ /// current compilation environment. use errors::DiagnosticBuilder; +use rustc_expand::base::{self, *}; use syntax::ast; use syntax::attr; use syntax::token; use syntax::tokenstream::TokenStream; -use syntax_expand::base::{self, *}; use syntax_pos::Span; pub fn expand_cfg( diff --git a/src/libsyntax_ext/cmdline_attrs.rs b/src/librustc_builtin_macros/cmdline_attrs.rs similarity index 97% rename from src/libsyntax_ext/cmdline_attrs.rs rename to src/librustc_builtin_macros/cmdline_attrs.rs index 1ce083112a8d1..ea33d4c2c464a 100644 --- a/src/libsyntax_ext/cmdline_attrs.rs +++ b/src/librustc_builtin_macros/cmdline_attrs.rs @@ -1,10 +1,10 @@ //! Attributes injected into the crate root from command line using `-Z crate-attr`. +use rustc_expand::panictry; use syntax::ast::{self, AttrItem, AttrStyle}; use syntax::attr::mk_attr; use syntax::sess::ParseSess; use syntax::token; -use syntax_expand::panictry; use syntax_pos::FileName; pub fn inject(mut krate: ast::Crate, parse_sess: &ParseSess, attrs: &[String]) -> ast::Crate { diff --git a/src/libsyntax_ext/compile_error.rs b/src/librustc_builtin_macros/compile_error.rs similarity index 93% rename from src/libsyntax_ext/compile_error.rs rename to src/librustc_builtin_macros/compile_error.rs index 394259fc67b10..95bcb6b075bcf 100644 --- a/src/libsyntax_ext/compile_error.rs +++ b/src/librustc_builtin_macros/compile_error.rs @@ -1,7 +1,7 @@ // The compiler code necessary to support the compile_error! extension. +use rustc_expand::base::{self, *}; use syntax::tokenstream::TokenStream; -use syntax_expand::base::{self, *}; use syntax_pos::Span; pub fn expand_compile_error<'cx>( diff --git a/src/libsyntax_ext/concat.rs b/src/librustc_builtin_macros/concat.rs similarity index 97% rename from src/libsyntax_ext/concat.rs rename to src/librustc_builtin_macros/concat.rs index 0cc8e205ae9d7..4dab74610c3e3 100644 --- a/src/libsyntax_ext/concat.rs +++ b/src/librustc_builtin_macros/concat.rs @@ -1,7 +1,7 @@ +use rustc_expand::base::{self, DummyResult}; use syntax::ast; use syntax::symbol::Symbol; use syntax::tokenstream::TokenStream; -use syntax_expand::base::{self, DummyResult}; use std::string::String; diff --git a/src/libsyntax_ext/concat_idents.rs b/src/librustc_builtin_macros/concat_idents.rs similarity index 98% rename from src/libsyntax_ext/concat_idents.rs rename to src/librustc_builtin_macros/concat_idents.rs index d870e858bea4b..4b5ade9823706 100644 --- a/src/libsyntax_ext/concat_idents.rs +++ b/src/librustc_builtin_macros/concat_idents.rs @@ -1,8 +1,8 @@ +use rustc_expand::base::{self, *}; use syntax::ast; use syntax::ptr::P; use syntax::token::{self, Token}; use syntax::tokenstream::{TokenStream, TokenTree}; -use syntax_expand::base::{self, *}; use syntax_pos::symbol::Symbol; use syntax_pos::Span; diff --git a/src/libsyntax_ext/deriving/bounds.rs b/src/librustc_builtin_macros/deriving/bounds.rs similarity index 93% rename from src/libsyntax_ext/deriving/bounds.rs rename to src/librustc_builtin_macros/deriving/bounds.rs index 9793ac1ca08b3..7027ca979c6a0 100644 --- a/src/libsyntax_ext/deriving/bounds.rs +++ b/src/librustc_builtin_macros/deriving/bounds.rs @@ -2,8 +2,8 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::path_std; +use rustc_expand::base::{Annotatable, ExtCtxt}; use syntax::ast::MetaItem; -use syntax_expand::base::{Annotatable, ExtCtxt}; use syntax_pos::Span; pub fn expand_deriving_copy( diff --git a/src/libsyntax_ext/deriving/clone.rs b/src/librustc_builtin_macros/deriving/clone.rs similarity index 99% rename from src/libsyntax_ext/deriving/clone.rs rename to src/librustc_builtin_macros/deriving/clone.rs index 171e4104c0ac8..a5971bb917656 100644 --- a/src/libsyntax_ext/deriving/clone.rs +++ b/src/librustc_builtin_macros/deriving/clone.rs @@ -2,10 +2,10 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::path_std; +use rustc_expand::base::{Annotatable, ExtCtxt}; use syntax::ast::{self, Expr, GenericArg, Generics, ItemKind, MetaItem, VariantData}; use syntax::ptr::P; use syntax::symbol::{kw, sym, Symbol}; -use syntax_expand::base::{Annotatable, ExtCtxt}; use syntax_pos::Span; pub fn expand_deriving_clone( diff --git a/src/libsyntax_ext/deriving/cmp/eq.rs b/src/librustc_builtin_macros/deriving/cmp/eq.rs similarity index 98% rename from src/libsyntax_ext/deriving/cmp/eq.rs rename to src/librustc_builtin_macros/deriving/cmp/eq.rs index f292ec0e42802..c71ade7304c05 100644 --- a/src/libsyntax_ext/deriving/cmp/eq.rs +++ b/src/librustc_builtin_macros/deriving/cmp/eq.rs @@ -2,10 +2,10 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::path_std; +use rustc_expand::base::{Annotatable, ExtCtxt}; use syntax::ast::{self, Expr, GenericArg, Ident, MetaItem}; use syntax::ptr::P; use syntax::symbol::{sym, Symbol}; -use syntax_expand::base::{Annotatable, ExtCtxt}; use syntax_pos::Span; pub fn expand_deriving_eq( diff --git a/src/libsyntax_ext/deriving/cmp/ord.rs b/src/librustc_builtin_macros/deriving/cmp/ord.rs similarity index 98% rename from src/libsyntax_ext/deriving/cmp/ord.rs rename to src/librustc_builtin_macros/deriving/cmp/ord.rs index e009763da1b54..fc1349e3354fc 100644 --- a/src/libsyntax_ext/deriving/cmp/ord.rs +++ b/src/librustc_builtin_macros/deriving/cmp/ord.rs @@ -2,10 +2,10 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::path_std; +use rustc_expand::base::{Annotatable, ExtCtxt}; use syntax::ast::{self, Expr, MetaItem}; use syntax::ptr::P; use syntax::symbol::sym; -use syntax_expand::base::{Annotatable, ExtCtxt}; use syntax_pos::Span; pub fn expand_deriving_ord( diff --git a/src/libsyntax_ext/deriving/cmp/partial_eq.rs b/src/librustc_builtin_macros/deriving/cmp/partial_eq.rs similarity index 98% rename from src/libsyntax_ext/deriving/cmp/partial_eq.rs rename to src/librustc_builtin_macros/deriving/cmp/partial_eq.rs index 91c13b76a0082..6475c22c009dd 100644 --- a/src/libsyntax_ext/deriving/cmp/partial_eq.rs +++ b/src/librustc_builtin_macros/deriving/cmp/partial_eq.rs @@ -2,10 +2,10 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::{path_local, path_std}; +use rustc_expand::base::{Annotatable, ExtCtxt}; use syntax::ast::{BinOpKind, Expr, MetaItem}; use syntax::ptr::P; use syntax::symbol::sym; -use syntax_expand::base::{Annotatable, ExtCtxt}; use syntax_pos::Span; pub fn expand_deriving_partial_eq( diff --git a/src/libsyntax_ext/deriving/cmp/partial_ord.rs b/src/librustc_builtin_macros/deriving/cmp/partial_ord.rs similarity index 99% rename from src/libsyntax_ext/deriving/cmp/partial_ord.rs rename to src/librustc_builtin_macros/deriving/cmp/partial_ord.rs index 760ed325f36bc..3397f7886057c 100644 --- a/src/libsyntax_ext/deriving/cmp/partial_ord.rs +++ b/src/librustc_builtin_macros/deriving/cmp/partial_ord.rs @@ -4,10 +4,10 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::{path_local, path_std, pathvec_std}; +use rustc_expand::base::{Annotatable, ExtCtxt}; use syntax::ast::{self, BinOpKind, Expr, MetaItem}; use syntax::ptr::P; use syntax::symbol::{sym, Symbol}; -use syntax_expand::base::{Annotatable, ExtCtxt}; use syntax_pos::Span; pub fn expand_deriving_partial_ord( diff --git a/src/libsyntax_ext/deriving/debug.rs b/src/librustc_builtin_macros/deriving/debug.rs similarity index 99% rename from src/libsyntax_ext/deriving/debug.rs rename to src/librustc_builtin_macros/deriving/debug.rs index c145b63274e86..4a3790e85dd43 100644 --- a/src/libsyntax_ext/deriving/debug.rs +++ b/src/librustc_builtin_macros/deriving/debug.rs @@ -2,11 +2,11 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::path_std; +use rustc_expand::base::{Annotatable, ExtCtxt}; use syntax::ast::{self, Ident}; use syntax::ast::{Expr, MetaItem}; use syntax::ptr::P; use syntax::symbol::sym; -use syntax_expand::base::{Annotatable, ExtCtxt}; use syntax_pos::{Span, DUMMY_SP}; pub fn expand_deriving_debug( diff --git a/src/libsyntax_ext/deriving/decodable.rs b/src/librustc_builtin_macros/deriving/decodable.rs similarity index 99% rename from src/libsyntax_ext/deriving/decodable.rs rename to src/librustc_builtin_macros/deriving/decodable.rs index 7f21440d49a6b..290b8977b88ac 100644 --- a/src/libsyntax_ext/deriving/decodable.rs +++ b/src/librustc_builtin_macros/deriving/decodable.rs @@ -4,11 +4,11 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::pathvec_std; +use rustc_expand::base::{Annotatable, ExtCtxt}; use syntax::ast; use syntax::ast::{Expr, MetaItem, Mutability}; use syntax::ptr::P; use syntax::symbol::Symbol; -use syntax_expand::base::{Annotatable, ExtCtxt}; use syntax_pos::Span; pub fn expand_deriving_rustc_decodable( diff --git a/src/libsyntax_ext/deriving/default.rs b/src/librustc_builtin_macros/deriving/default.rs similarity index 97% rename from src/libsyntax_ext/deriving/default.rs rename to src/librustc_builtin_macros/deriving/default.rs index d623e1fa4cca4..284c407f35f5c 100644 --- a/src/libsyntax_ext/deriving/default.rs +++ b/src/librustc_builtin_macros/deriving/default.rs @@ -2,11 +2,11 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::path_std; +use rustc_expand::base::{Annotatable, DummyResult, ExtCtxt}; use syntax::ast::{Expr, MetaItem}; use syntax::ptr::P; use syntax::span_err; use syntax::symbol::{kw, sym}; -use syntax_expand::base::{Annotatable, DummyResult, ExtCtxt}; use syntax_pos::Span; use rustc_error_codes::*; diff --git a/src/libsyntax_ext/deriving/encodable.rs b/src/librustc_builtin_macros/deriving/encodable.rs similarity index 99% rename from src/libsyntax_ext/deriving/encodable.rs rename to src/librustc_builtin_macros/deriving/encodable.rs index 98b0160d6e84a..31f9e38ba3dc6 100644 --- a/src/libsyntax_ext/deriving/encodable.rs +++ b/src/librustc_builtin_macros/deriving/encodable.rs @@ -89,10 +89,10 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::pathvec_std; +use rustc_expand::base::{Annotatable, ExtCtxt}; use syntax::ast::{Expr, ExprKind, MetaItem, Mutability}; use syntax::ptr::P; use syntax::symbol::Symbol; -use syntax_expand::base::{Annotatable, ExtCtxt}; use syntax_pos::Span; pub fn expand_deriving_rustc_encodable( diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/librustc_builtin_macros/deriving/generic/mod.rs similarity index 99% rename from src/libsyntax_ext/deriving/generic/mod.rs rename to src/librustc_builtin_macros/deriving/generic/mod.rs index 7d7b73ebb4247..8af58e9e4ce7b 100644 --- a/src/libsyntax_ext/deriving/generic/mod.rs +++ b/src/librustc_builtin_macros/deriving/generic/mod.rs @@ -181,6 +181,7 @@ use std::cell::RefCell; use std::iter; use std::vec; +use rustc_expand::base::{Annotatable, ExtCtxt}; use syntax::ast::{self, BinOpKind, EnumDef, Expr, Generics, Ident, PatKind}; use syntax::ast::{GenericArg, GenericParamKind, VariantData}; use syntax::attr; @@ -189,7 +190,6 @@ use syntax::sess::ParseSess; use syntax::source_map::respan; use syntax::symbol::{kw, sym, Symbol}; use syntax::util::map_in_place::MapInPlace; -use syntax_expand::base::{Annotatable, ExtCtxt}; use syntax_pos::Span; use ty::{LifetimeBounds, Path, Ptr, PtrTy, Self_, Ty}; @@ -412,8 +412,8 @@ impl<'a> TraitDef<'a> { _ => { // Non-ADT derive is an error, but it should have been // set earlier; see - // libsyntax_expand/expand.rs:MacroExpander::fully_expand_fragment() - // libsyntax_expand/base.rs:Annotatable::derive_allowed() + // librustc_expand/expand.rs:MacroExpander::fully_expand_fragment() + // librustc_expand/base.rs:Annotatable::derive_allowed() return; } }; @@ -487,8 +487,8 @@ impl<'a> TraitDef<'a> { _ => { // Non-Item derive is an error, but it should have been // set earlier; see - // libsyntax_expand/expand.rs:MacroExpander::fully_expand_fragment() - // libsyntax_expand/base.rs:Annotatable::derive_allowed() + // librustc_expand/expand.rs:MacroExpander::fully_expand_fragment() + // librustc_expand/base.rs:Annotatable::derive_allowed() return; } } diff --git a/src/libsyntax_ext/deriving/generic/ty.rs b/src/librustc_builtin_macros/deriving/generic/ty.rs similarity index 99% rename from src/libsyntax_ext/deriving/generic/ty.rs rename to src/librustc_builtin_macros/deriving/generic/ty.rs index 7eab15aff77a8..993426501f525 100644 --- a/src/libsyntax_ext/deriving/generic/ty.rs +++ b/src/librustc_builtin_macros/deriving/generic/ty.rs @@ -4,10 +4,10 @@ pub use PtrTy::*; pub use Ty::*; +use rustc_expand::base::ExtCtxt; use syntax::ast::{self, Expr, GenericArg, GenericParamKind, Generics, Ident, SelfKind}; use syntax::ptr::P; use syntax::source_map::{respan, DUMMY_SP}; -use syntax_expand::base::ExtCtxt; use syntax_pos::symbol::kw; use syntax_pos::Span; diff --git a/src/libsyntax_ext/deriving/hash.rs b/src/librustc_builtin_macros/deriving/hash.rs similarity index 98% rename from src/libsyntax_ext/deriving/hash.rs rename to src/librustc_builtin_macros/deriving/hash.rs index acf18ac70e6a6..e75fe1a308c61 100644 --- a/src/libsyntax_ext/deriving/hash.rs +++ b/src/librustc_builtin_macros/deriving/hash.rs @@ -2,10 +2,10 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::{self, path_std, pathvec_std}; +use rustc_expand::base::{Annotatable, ExtCtxt}; use syntax::ast::{Expr, MetaItem, Mutability}; use syntax::ptr::P; use syntax::symbol::sym; -use syntax_expand::base::{Annotatable, ExtCtxt}; use syntax_pos::Span; pub fn expand_deriving_hash( diff --git a/src/libsyntax_ext/deriving/mod.rs b/src/librustc_builtin_macros/deriving/mod.rs similarity index 95% rename from src/libsyntax_ext/deriving/mod.rs rename to src/librustc_builtin_macros/deriving/mod.rs index ca4d4fbc5bd1d..0856c0c2a9f94 100644 --- a/src/libsyntax_ext/deriving/mod.rs +++ b/src/librustc_builtin_macros/deriving/mod.rs @@ -1,9 +1,9 @@ //! The compiler code necessary to implement the `#[derive]` extensions. +use rustc_expand::base::{Annotatable, ExtCtxt, MultiItemModifier}; use syntax::ast::{self, ItemKind, MetaItem}; use syntax::ptr::P; use syntax::symbol::{sym, Symbol}; -use syntax_expand::base::{Annotatable, ExtCtxt, MultiItemModifier}; use syntax_pos::Span; macro path_local($x:ident) { @@ -92,8 +92,8 @@ fn inject_impl_of_structural_trait( _ => { // Non-Item derive is an error, but it should have been // set earlier; see - // libsyntax_expand/expand.rs:MacroExpander::fully_expand_fragment() - // libsyntax_expand/base.rs:Annotatable::derive_allowed() + // librustc_expand/expand.rs:MacroExpander::fully_expand_fragment() + // librustc_expand/base.rs:Annotatable::derive_allowed() return; } }; diff --git a/src/libsyntax_ext/env.rs b/src/librustc_builtin_macros/env.rs similarity index 98% rename from src/libsyntax_ext/env.rs rename to src/librustc_builtin_macros/env.rs index c9ecbabc8ff4e..dd78cecc85fee 100644 --- a/src/libsyntax_ext/env.rs +++ b/src/librustc_builtin_macros/env.rs @@ -3,10 +3,10 @@ // interface. // +use rustc_expand::base::{self, *}; use syntax::ast::{self, GenericArg, Ident}; use syntax::symbol::{kw, sym, Symbol}; use syntax::tokenstream::TokenStream; -use syntax_expand::base::{self, *}; use syntax_pos::Span; use std::env; diff --git a/src/libsyntax_ext/format.rs b/src/librustc_builtin_macros/format.rs similarity index 99% rename from src/libsyntax_ext/format.rs rename to src/librustc_builtin_macros/format.rs index 1d1f68a49064f..7b915a66dacc9 100644 --- a/src/libsyntax_ext/format.rs +++ b/src/librustc_builtin_macros/format.rs @@ -7,12 +7,12 @@ use errors::pluralize; use errors::Applicability; use errors::DiagnosticBuilder; +use rustc_expand::base::{self, *}; use syntax::ast; use syntax::ptr::P; use syntax::symbol::{sym, Symbol}; use syntax::token; use syntax::tokenstream::TokenStream; -use syntax_expand::base::{self, *}; use syntax_pos::{MultiSpan, Span}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; diff --git a/src/libsyntax_ext/format_foreign.rs b/src/librustc_builtin_macros/format_foreign.rs similarity index 100% rename from src/libsyntax_ext/format_foreign.rs rename to src/librustc_builtin_macros/format_foreign.rs diff --git a/src/libsyntax_ext/format_foreign/printf/tests.rs b/src/librustc_builtin_macros/format_foreign/printf/tests.rs similarity index 100% rename from src/libsyntax_ext/format_foreign/printf/tests.rs rename to src/librustc_builtin_macros/format_foreign/printf/tests.rs diff --git a/src/libsyntax_ext/format_foreign/shell/tests.rs b/src/librustc_builtin_macros/format_foreign/shell/tests.rs similarity index 100% rename from src/libsyntax_ext/format_foreign/shell/tests.rs rename to src/librustc_builtin_macros/format_foreign/shell/tests.rs diff --git a/src/libsyntax_ext/global_allocator.rs b/src/librustc_builtin_macros/global_allocator.rs similarity index 99% rename from src/libsyntax_ext/global_allocator.rs rename to src/librustc_builtin_macros/global_allocator.rs index edfdda4703c41..37fcd3cadbac8 100644 --- a/src/libsyntax_ext/global_allocator.rs +++ b/src/librustc_builtin_macros/global_allocator.rs @@ -1,11 +1,11 @@ use crate::util::check_builtin_macro_attribute; +use rustc_expand::base::{Annotatable, ExtCtxt}; use syntax::ast::{self, Attribute, Expr, FnHeader, FnSig, Generics, Ident, Param}; use syntax::ast::{ItemKind, Mutability, Stmt, Ty, TyKind, Unsafety}; 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/global_asm.rs b/src/librustc_builtin_macros/global_asm.rs similarity index 98% rename from src/libsyntax_ext/global_asm.rs rename to src/librustc_builtin_macros/global_asm.rs index fc933e4673ad0..97ae8012ae3ae 100644 --- a/src/libsyntax_ext/global_asm.rs +++ b/src/librustc_builtin_macros/global_asm.rs @@ -9,13 +9,13 @@ /// therefore apply. use errors::DiagnosticBuilder; +use rustc_expand::base::{self, *}; use smallvec::smallvec; use syntax::ast; use syntax::ptr::P; use syntax::source_map::respan; use syntax::token; use syntax::tokenstream::TokenStream; -use syntax_expand::base::{self, *}; use syntax_pos::Span; pub fn expand_global_asm<'cx>( diff --git a/src/libsyntax_ext/lib.rs b/src/librustc_builtin_macros/lib.rs similarity index 96% rename from src/libsyntax_ext/lib.rs rename to src/librustc_builtin_macros/lib.rs index 40aafece8c632..e9709d981fed4 100644 --- a/src/libsyntax_ext/lib.rs +++ b/src/librustc_builtin_macros/lib.rs @@ -13,11 +13,11 @@ extern crate proc_macro; use crate::deriving::*; +use rustc_expand::base::{MacroExpanderFn, Resolver, SyntaxExtension, SyntaxExtensionKind}; +use rustc_expand::proc_macro::BangProcMacro; use syntax::ast::Ident; use syntax::edition::Edition; use syntax::symbol::sym; -use syntax_expand::base::{MacroExpanderFn, Resolver, SyntaxExtension, SyntaxExtensionKind}; -use syntax_expand::proc_macro::BangProcMacro; mod asm; mod assert; diff --git a/src/libsyntax_ext/log_syntax.rs b/src/librustc_builtin_macros/log_syntax.rs similarity index 94% rename from src/libsyntax_ext/log_syntax.rs rename to src/librustc_builtin_macros/log_syntax.rs index 111226be87748..f873b1790da1b 100644 --- a/src/libsyntax_ext/log_syntax.rs +++ b/src/librustc_builtin_macros/log_syntax.rs @@ -1,6 +1,6 @@ +use rustc_expand::base; use syntax::print; use syntax::tokenstream::TokenStream; -use syntax_expand::base; use syntax_pos; pub fn expand_log_syntax<'cx>( diff --git a/src/libsyntax_ext/proc_macro_harness.rs b/src/librustc_builtin_macros/proc_macro_harness.rs similarity index 99% rename from src/libsyntax_ext/proc_macro_harness.rs rename to src/librustc_builtin_macros/proc_macro_harness.rs index b6436cc164611..bdd7b1d8993d2 100644 --- a/src/libsyntax_ext/proc_macro_harness.rs +++ b/src/librustc_builtin_macros/proc_macro_harness.rs @@ -1,5 +1,7 @@ use std::mem; +use rustc_expand::base::{ExtCtxt, Resolver}; +use rustc_expand::expand::{AstFragment, ExpansionConfig}; use smallvec::smallvec; use syntax::ast::{self, Ident}; use syntax::attr; @@ -9,8 +11,6 @@ use syntax::ptr::P; use syntax::sess::ParseSess; use syntax::symbol::{kw, sym}; use syntax::visit::{self, Visitor}; -use syntax_expand::base::{ExtCtxt, Resolver}; -use syntax_expand::expand::{AstFragment, ExpansionConfig}; use syntax_pos::hygiene::AstPass; use syntax_pos::{Span, DUMMY_SP}; diff --git a/src/libsyntax_ext/source_util.rs b/src/librustc_builtin_macros/source_util.rs similarity index 99% rename from src/libsyntax_ext/source_util.rs rename to src/librustc_builtin_macros/source_util.rs index fccc36e2ea809..9e756c4c0e46f 100644 --- a/src/libsyntax_ext/source_util.rs +++ b/src/librustc_builtin_macros/source_util.rs @@ -1,3 +1,5 @@ +use rustc_expand::base::{self, *}; +use rustc_expand::panictry; use rustc_parse::{self, new_sub_parser_from_file, parser::Parser, DirectoryOwnership}; use syntax::ast; use syntax::early_buffered_lints::INCOMPLETE_INCLUDE; @@ -6,8 +8,6 @@ use syntax::ptr::P; use syntax::symbol::Symbol; use syntax::token; use syntax::tokenstream::TokenStream; -use syntax_expand::base::{self, *}; -use syntax_expand::panictry; use smallvec::SmallVec; use syntax_pos::{self, Pos, Span}; diff --git a/src/libsyntax_ext/standard_library_imports.rs b/src/librustc_builtin_macros/standard_library_imports.rs similarity index 96% rename from src/libsyntax_ext/standard_library_imports.rs rename to src/librustc_builtin_macros/standard_library_imports.rs index 50f86a0f3ec87..41da95e0ecc97 100644 --- a/src/libsyntax_ext/standard_library_imports.rs +++ b/src/librustc_builtin_macros/standard_library_imports.rs @@ -1,10 +1,10 @@ +use rustc_expand::base::{ExtCtxt, Resolver}; +use rustc_expand::expand::ExpansionConfig; use syntax::edition::Edition; use syntax::ptr::P; use syntax::sess::ParseSess; use syntax::symbol::{kw, sym, Ident, Symbol}; use syntax::{ast, attr}; -use syntax_expand::base::{ExtCtxt, Resolver}; -use syntax_expand::expand::ExpansionConfig; use syntax_pos::hygiene::AstPass; use syntax_pos::DUMMY_SP; diff --git a/src/libsyntax_ext/test.rs b/src/librustc_builtin_macros/test.rs similarity index 99% rename from src/libsyntax_ext/test.rs rename to src/librustc_builtin_macros/test.rs index edf427edaae15..dccaf0199982d 100644 --- a/src/libsyntax_ext/test.rs +++ b/src/librustc_builtin_macros/test.rs @@ -2,12 +2,12 @@ /// 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_expand::base::*; use syntax::ast; use syntax::attr; use syntax::print::pprust; use syntax::source_map::respan; use syntax::symbol::{sym, Symbol}; -use syntax_expand::base::*; use syntax_pos::Span; use std::iter; diff --git a/src/libsyntax_ext/test_harness.rs b/src/librustc_builtin_macros/test_harness.rs similarity index 99% rename from src/libsyntax_ext/test_harness.rs rename to src/librustc_builtin_macros/test_harness.rs index b00fc3d26c1f5..e596f3e4432a5 100644 --- a/src/libsyntax_ext/test_harness.rs +++ b/src/librustc_builtin_macros/test_harness.rs @@ -1,6 +1,8 @@ // Code that generates a test runner to run all the tests in a crate use log::debug; +use rustc_expand::base::{ExtCtxt, Resolver}; +use rustc_expand::expand::{AstFragment, ExpansionConfig}; use rustc_feature::Features; use rustc_target::spec::PanicStrategy; use smallvec::{smallvec, SmallVec}; @@ -12,8 +14,6 @@ use syntax::ptr::P; use syntax::sess::ParseSess; use syntax::source_map::respan; use syntax::symbol::{sym, Symbol}; -use syntax_expand::base::{ExtCtxt, Resolver}; -use syntax_expand::expand::{AstFragment, ExpansionConfig}; use syntax_pos::hygiene::{AstPass, SyntaxContext, Transparency}; use syntax_pos::{Span, DUMMY_SP}; diff --git a/src/libsyntax_ext/trace_macros.rs b/src/librustc_builtin_macros/trace_macros.rs similarity index 94% rename from src/libsyntax_ext/trace_macros.rs rename to src/librustc_builtin_macros/trace_macros.rs index 96ae5bf5b4e9b..450a7269fd471 100644 --- a/src/libsyntax_ext/trace_macros.rs +++ b/src/librustc_builtin_macros/trace_macros.rs @@ -1,6 +1,6 @@ +use rustc_expand::base::{self, ExtCtxt}; use syntax::symbol::kw; use syntax::tokenstream::{TokenStream, TokenTree}; -use syntax_expand::base::{self, ExtCtxt}; use syntax_pos::Span; pub fn expand_trace_macros( diff --git a/src/libsyntax_ext/util.rs b/src/librustc_builtin_macros/util.rs similarity index 93% rename from src/libsyntax_ext/util.rs rename to src/librustc_builtin_macros/util.rs index aedd5aac1a95e..bd748c0c8c1f3 100644 --- a/src/libsyntax_ext/util.rs +++ b/src/librustc_builtin_macros/util.rs @@ -1,7 +1,7 @@ +use rustc_expand::base::ExtCtxt; use rustc_feature::AttributeTemplate; use rustc_parse::validate_attr; use syntax::ast::MetaItem; -use syntax_expand::base::ExtCtxt; use syntax_pos::Symbol; pub fn check_builtin_macro_attribute(ecx: &ExtCtxt<'_>, meta_item: &MetaItem, name: Symbol) { diff --git a/src/librustc_codegen_llvm/Cargo.toml b/src/librustc_codegen_llvm/Cargo.toml index 71cfacfa56058..e0b303710bfad 100644 --- a/src/librustc_codegen_llvm/Cargo.toml +++ b/src/librustc_codegen_llvm/Cargo.toml @@ -30,5 +30,5 @@ rustc_session = { path = "../librustc_session" } rustc_target = { path = "../librustc_target" } smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } syntax = { path = "../libsyntax" } -syntax_expand = { path = "../libsyntax_expand" } -syntax_pos = { path = "../libsyntax_pos" } +rustc_expand = { path = "../librustc_expand" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } diff --git a/src/librustc_codegen_ssa/Cargo.toml b/src/librustc_codegen_ssa/Cargo.toml index d489852a1a43d..1f20d1fbc2a2d 100644 --- a/src/librustc_codegen_ssa/Cargo.toml +++ b/src/librustc_codegen_ssa/Cargo.toml @@ -21,7 +21,7 @@ tempfile = "3.1" rustc_serialize = { path = "../libserialize", package = "serialize" } syntax = { path = "../libsyntax" } -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } rustc = { path = "../librustc" } rustc_apfloat = { path = "../librustc_apfloat" } rustc_codegen_utils = { path = "../librustc_codegen_utils" } diff --git a/src/librustc_codegen_utils/Cargo.toml b/src/librustc_codegen_utils/Cargo.toml index c8c219d039a73..09c6dfe5dc0de 100644 --- a/src/librustc_codegen_utils/Cargo.toml +++ b/src/librustc_codegen_utils/Cargo.toml @@ -15,7 +15,7 @@ punycode = "0.4.0" rustc-demangle = "0.1.16" syntax = { path = "../libsyntax" } -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } rustc = { path = "../librustc" } rustc_target = { path = "../librustc_target" } rustc_data_structures = { path = "../librustc_data_structures" } diff --git a/src/librustc_driver/Cargo.toml b/src/librustc_driver/Cargo.toml index 043cfc58974b7..c005ea12cef38 100644 --- a/src/librustc_driver/Cargo.toml +++ b/src/librustc_driver/Cargo.toml @@ -31,7 +31,7 @@ rustc_interface = { path = "../librustc_interface" } rustc_serialize = { path = "../libserialize", package = "serialize" } rustc_resolve = { path = "../librustc_resolve" } syntax = { path = "../libsyntax" } -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } [features] llvm = ['rustc_interface/llvm'] diff --git a/src/librustc_errors/Cargo.toml b/src/librustc_errors/Cargo.toml index 1541845bb55f6..8a21150570abd 100644 --- a/src/librustc_errors/Cargo.toml +++ b/src/librustc_errors/Cargo.toml @@ -12,7 +12,7 @@ doctest = false [dependencies] log = "0.4" rustc_serialize = { path = "../libserialize", package = "serialize" } -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } rustc_data_structures = { path = "../librustc_data_structures" } unicode-width = "0.1.4" atty = "0.2" diff --git a/src/libsyntax_expand/Cargo.toml b/src/librustc_expand/Cargo.toml similarity index 84% rename from src/libsyntax_expand/Cargo.toml rename to src/librustc_expand/Cargo.toml index 897d5a65ba3de..36273ec0806ba 100644 --- a/src/libsyntax_expand/Cargo.toml +++ b/src/librustc_expand/Cargo.toml @@ -1,19 +1,19 @@ [package] authors = ["The Rust Project Developers"] -name = "syntax_expand" +name = "rustc_expand" version = "0.0.0" edition = "2018" build = false [lib] -name = "syntax_expand" +name = "rustc_expand" path = "lib.rs" doctest = false [dependencies] rustc_serialize = { path = "../libserialize", package = "serialize" } log = "0.4" -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } errors = { path = "../librustc_errors", package = "rustc_errors" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_feature = { path = "../librustc_feature" } diff --git a/src/libsyntax_expand/base.rs b/src/librustc_expand/base.rs similarity index 100% rename from src/libsyntax_expand/base.rs rename to src/librustc_expand/base.rs diff --git a/src/libsyntax_expand/build.rs b/src/librustc_expand/build.rs similarity index 100% rename from src/libsyntax_expand/build.rs rename to src/librustc_expand/build.rs diff --git a/src/libsyntax_expand/expand.rs b/src/librustc_expand/expand.rs similarity index 100% rename from src/libsyntax_expand/expand.rs rename to src/librustc_expand/expand.rs diff --git a/src/libsyntax_expand/lib.rs b/src/librustc_expand/lib.rs similarity index 100% rename from src/libsyntax_expand/lib.rs rename to src/librustc_expand/lib.rs diff --git a/src/libsyntax_expand/mbe.rs b/src/librustc_expand/mbe.rs similarity index 100% rename from src/libsyntax_expand/mbe.rs rename to src/librustc_expand/mbe.rs diff --git a/src/libsyntax_expand/mbe/macro_check.rs b/src/librustc_expand/mbe/macro_check.rs similarity index 100% rename from src/libsyntax_expand/mbe/macro_check.rs rename to src/librustc_expand/mbe/macro_check.rs diff --git a/src/libsyntax_expand/mbe/macro_parser.rs b/src/librustc_expand/mbe/macro_parser.rs similarity index 100% rename from src/libsyntax_expand/mbe/macro_parser.rs rename to src/librustc_expand/mbe/macro_parser.rs diff --git a/src/libsyntax_expand/mbe/macro_rules.rs b/src/librustc_expand/mbe/macro_rules.rs similarity index 100% rename from src/libsyntax_expand/mbe/macro_rules.rs rename to src/librustc_expand/mbe/macro_rules.rs diff --git a/src/libsyntax_expand/mbe/quoted.rs b/src/librustc_expand/mbe/quoted.rs similarity index 100% rename from src/libsyntax_expand/mbe/quoted.rs rename to src/librustc_expand/mbe/quoted.rs diff --git a/src/libsyntax_expand/mbe/transcribe.rs b/src/librustc_expand/mbe/transcribe.rs similarity index 100% rename from src/libsyntax_expand/mbe/transcribe.rs rename to src/librustc_expand/mbe/transcribe.rs diff --git a/src/libsyntax_expand/mut_visit/tests.rs b/src/librustc_expand/mut_visit/tests.rs similarity index 100% rename from src/libsyntax_expand/mut_visit/tests.rs rename to src/librustc_expand/mut_visit/tests.rs diff --git a/src/libsyntax_expand/parse/lexer/tests.rs b/src/librustc_expand/parse/lexer/tests.rs similarity index 100% rename from src/libsyntax_expand/parse/lexer/tests.rs rename to src/librustc_expand/parse/lexer/tests.rs diff --git a/src/libsyntax_expand/parse/tests.rs b/src/librustc_expand/parse/tests.rs similarity index 100% rename from src/libsyntax_expand/parse/tests.rs rename to src/librustc_expand/parse/tests.rs diff --git a/src/libsyntax_expand/placeholders.rs b/src/librustc_expand/placeholders.rs similarity index 100% rename from src/libsyntax_expand/placeholders.rs rename to src/librustc_expand/placeholders.rs diff --git a/src/libsyntax_expand/proc_macro.rs b/src/librustc_expand/proc_macro.rs similarity index 100% rename from src/libsyntax_expand/proc_macro.rs rename to src/librustc_expand/proc_macro.rs diff --git a/src/libsyntax_expand/proc_macro_server.rs b/src/librustc_expand/proc_macro_server.rs similarity index 100% rename from src/libsyntax_expand/proc_macro_server.rs rename to src/librustc_expand/proc_macro_server.rs diff --git a/src/libsyntax_expand/tests.rs b/src/librustc_expand/tests.rs similarity index 100% rename from src/libsyntax_expand/tests.rs rename to src/librustc_expand/tests.rs diff --git a/src/libsyntax_expand/tokenstream/tests.rs b/src/librustc_expand/tokenstream/tests.rs similarity index 100% rename from src/libsyntax_expand/tokenstream/tests.rs rename to src/librustc_expand/tokenstream/tests.rs diff --git a/src/librustc_feature/Cargo.toml b/src/librustc_feature/Cargo.toml index 40ce922947bcb..e9e3e471ce662 100644 --- a/src/librustc_feature/Cargo.toml +++ b/src/librustc_feature/Cargo.toml @@ -12,4 +12,4 @@ doctest = false [dependencies] rustc_data_structures = { path = "../librustc_data_structures" } lazy_static = "1.0.0" -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } diff --git a/src/librustc_incremental/Cargo.toml b/src/librustc_incremental/Cargo.toml index 8dac7263f4d2c..3fd67395b6b9a 100644 --- a/src/librustc_incremental/Cargo.toml +++ b/src/librustc_incremental/Cargo.toml @@ -17,6 +17,6 @@ rustc = { path = "../librustc" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_serialize = { path = "../libserialize", package = "serialize" } syntax = { path = "../libsyntax" } -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } rustc_fs_util = { path = "../librustc_fs_util" } rustc_session = { path = "../librustc_session" } diff --git a/src/librustc_interface/Cargo.toml b/src/librustc_interface/Cargo.toml index 58fd92822e9a2..73ff0cd52d7e2 100644 --- a/src/librustc_interface/Cargo.toml +++ b/src/librustc_interface/Cargo.toml @@ -14,10 +14,10 @@ log = "0.4" rayon = { version = "0.3.0", package = "rustc-rayon" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } syntax = { path = "../libsyntax" } -syntax_ext = { path = "../libsyntax_ext" } -syntax_expand = { path = "../libsyntax_expand" } +rustc_builtin_macros = { path = "../librustc_builtin_macros" } +rustc_expand = { path = "../librustc_expand" } rustc_parse = { path = "../librustc_parse" } -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } rustc_serialize = { path = "../libserialize", package = "serialize" } rustc = { path = "../librustc" } rustc_incremental = { path = "../librustc_incremental" } diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index b4522f4c66531..57fd2fb6d2783 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -19,12 +19,14 @@ use rustc::traits; use rustc::ty::steal::Steal; use rustc::ty::{self, AllArenas, GlobalCtxt, ResolverOutputs, TyCtxt}; use rustc::util::common::{time, ErrorReported}; +use rustc_builtin_macros; use rustc_codegen_ssa::back::link::emit_metadata; use rustc_codegen_utils::codegen_backend::CodegenBackend; use rustc_codegen_utils::link::filename_for_metadata; use rustc_data_structures::sync::{par_iter, Lrc, Once, ParallelIterator, WorkerLocal}; use rustc_data_structures::{box_region_allow_access, declare_box_region_type, parallel}; use rustc_errors::PResult; +use rustc_expand::base::ExtCtxt; use rustc_incremental; use rustc_mir as mir; use rustc_parse::{parse_crate_from_file, parse_crate_from_source_str}; @@ -39,8 +41,6 @@ use syntax::mut_visit::MutVisitor; use syntax::symbol::Symbol; use syntax::util::node_count::NodeCounter; use syntax::{self, ast, visit}; -use syntax_expand::base::ExtCtxt; -use syntax_ext; use syntax_pos::FileName; use rustc_serialize::json; @@ -164,14 +164,14 @@ pub fn register_plugins<'a>( crate_name: &str, ) -> Result<(ast::Crate, Lrc)> { krate = time(sess, "attributes injection", || { - syntax_ext::cmdline_attrs::inject( + rustc_builtin_macros::cmdline_attrs::inject( krate, &sess.parse_sess, &sess.opts.debugging_opts.crate_attr, ) }); - let (krate, features) = syntax_expand::config::features( + let (krate, features) = rustc_expand::config::features( krate, &sess.parse_sess, sess.edition(), @@ -243,11 +243,11 @@ fn configure_and_expand_inner<'a>( }); let mut resolver = Resolver::new(sess, &krate, crate_name, metadata_loader, &resolver_arenas); - syntax_ext::register_builtin_macros(&mut resolver, sess.edition()); + rustc_builtin_macros::register_builtin_macros(&mut resolver, sess.edition()); krate = time(sess, "crate injection", || { let alt_std_name = sess.opts.alt_std_name.as_ref().map(|s| Symbol::intern(s)); - let (krate, name) = syntax_ext::standard_library_imports::inject( + let (krate, name) = rustc_builtin_macros::standard_library_imports::inject( krate, &mut resolver, &sess.parse_sess, @@ -297,12 +297,12 @@ fn configure_and_expand_inner<'a>( // Create the config for macro expansion let features = sess.features_untracked(); - let cfg = syntax_expand::expand::ExpansionConfig { + let cfg = rustc_expand::expand::ExpansionConfig { features: Some(&features), recursion_limit: *sess.recursion_limit.get(), trace_mac: sess.opts.debugging_opts.trace_macros, should_test: sess.opts.test, - ..syntax_expand::expand::ExpansionConfig::default(crate_name.to_string()) + ..rustc_expand::expand::ExpansionConfig::default(crate_name.to_string()) }; let mut ecx = ExtCtxt::new(&sess.parse_sess, cfg, &mut resolver); @@ -332,7 +332,7 @@ fn configure_and_expand_inner<'a>( }); time(sess, "maybe building test harness", || { - syntax_ext::test_harness::inject( + rustc_builtin_macros::test_harness::inject( &sess.parse_sess, &mut resolver, sess.opts.test, @@ -380,7 +380,7 @@ fn configure_and_expand_inner<'a>( krate = time(sess, "maybe creating a macro crate", || { let num_crate_types = crate_types.len(); let is_test_crate = sess.opts.test; - syntax_ext::proc_macro_harness::inject( + rustc_builtin_macros::proc_macro_harness::inject( &sess.parse_sess, &mut resolver, krate, diff --git a/src/librustc_lint/Cargo.toml b/src/librustc_lint/Cargo.toml index e834b87896ddf..049ea6fa1829b 100644 --- a/src/librustc_lint/Cargo.toml +++ b/src/librustc_lint/Cargo.toml @@ -13,7 +13,7 @@ log = "0.4" rustc = { path = "../librustc" } rustc_target = { path = "../librustc_target" } syntax = { path = "../libsyntax" } -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_feature = { path = "../librustc_feature" } rustc_index = { path = "../librustc_index" } diff --git a/src/librustc_metadata/Cargo.toml b/src/librustc_metadata/Cargo.toml index 88d1c501bae5c..e22a808865414 100644 --- a/src/librustc_metadata/Cargo.toml +++ b/src/librustc_metadata/Cargo.toml @@ -22,7 +22,7 @@ rustc_index = { path = "../librustc_index" } rustc_serialize = { path = "../libserialize", package = "serialize" } stable_deref_trait = "1.0.0" syntax = { path = "../libsyntax" } -syntax_expand = { path = "../libsyntax_expand" } +rustc_expand = { path = "../librustc_expand" } rustc_parse = { path = "../librustc_parse" } -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } rustc_error_codes = { path = "../librustc_error_codes" } diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs index 80d7e71e96bb6..88ad5aba88ed1 100644 --- a/src/librustc_metadata/creader.rs +++ b/src/librustc_metadata/creader.rs @@ -22,13 +22,13 @@ use std::{cmp, fs}; use log::{debug, info, log_enabled}; use proc_macro::bridge::client::ProcMacro; +use rustc_expand::base::SyntaxExtension; use syntax::ast; use syntax::attr; use syntax::edition::Edition; use syntax::expand::allocator::{global_allocator_spans, AllocatorKind}; use syntax::span_fatal; use syntax::symbol::{sym, Symbol}; -use syntax_expand::base::SyntaxExtension; use syntax_pos::{Span, DUMMY_SP}; use rustc_error_codes::*; diff --git a/src/librustc_metadata/rmeta/decoder.rs b/src/librustc_metadata/rmeta/decoder.rs index d0f86f96e0759..5b25e192f902d 100644 --- a/src/librustc_metadata/rmeta/decoder.rs +++ b/src/librustc_metadata/rmeta/decoder.rs @@ -33,12 +33,12 @@ use std::u32; use log::debug; use proc_macro::bridge::client::ProcMacro; +use rustc_expand::base::{SyntaxExtension, SyntaxExtensionKind}; +use rustc_expand::proc_macro::{AttrProcMacro, BangProcMacro, ProcMacroDerive}; use rustc_serialize::{opaque, Decodable, Decoder, SpecializedDecoder}; use syntax::ast::{self, Ident}; use syntax::attr; use syntax::source_map::{self, respan, Spanned}; -use syntax_expand::base::{SyntaxExtension, SyntaxExtensionKind}; -use syntax_expand::proc_macro::{AttrProcMacro, BangProcMacro, ProcMacroDerive}; use syntax_pos::symbol::{sym, Symbol}; use syntax_pos::{self, hygiene::MacroKind, BytePos, Pos, Span, DUMMY_SP}; @@ -637,7 +637,7 @@ impl<'a, 'tcx> CrateMetadata { // DefIndex's in root.proc_macro_data have a one-to-one correspondence // with items in 'raw_proc_macros'. // NOTE: If you update the order of macros in 'proc_macro_data' for any reason, - // you must also update src/libsyntax_ext/proc_macro_harness.rs + // you must also update src/librustc_builtin_macros/proc_macro_harness.rs // Failing to do so will result in incorrect data being associated // with proc macros when deserialized. let pos = self.root.proc_macro_data.unwrap().decode(self).position(|i| i == id).unwrap(); diff --git a/src/librustc_mir/Cargo.toml b/src/librustc_mir/Cargo.toml index 7e3bd98176e6a..dce6c2a65e023 100644 --- a/src/librustc_mir/Cargo.toml +++ b/src/librustc_mir/Cargo.toml @@ -26,7 +26,7 @@ rustc_lexer = { path = "../librustc_lexer" } rustc_macros = { path = "../librustc_macros" } rustc_serialize = { path = "../libserialize", package = "serialize" } syntax = { path = "../libsyntax" } -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } rustc_apfloat = { path = "../librustc_apfloat" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } rustc_error_codes = { path = "../librustc_error_codes" } diff --git a/src/librustc_parse/Cargo.toml b/src/librustc_parse/Cargo.toml index 73458a444f4c6..086e6a6bf5c53 100644 --- a/src/librustc_parse/Cargo.toml +++ b/src/librustc_parse/Cargo.toml @@ -18,6 +18,6 @@ rustc_lexer = { path = "../librustc_lexer" } rustc_errors = { path = "../librustc_errors" } rustc_error_codes = { path = "../librustc_error_codes" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } syntax = { path = "../libsyntax" } unicode-normalization = "0.1.11" diff --git a/src/librustc_parse/config.rs b/src/librustc_parse/config.rs index 1ff2003e82ce0..63892eb8995a1 100644 --- a/src/librustc_parse/config.rs +++ b/src/librustc_parse/config.rs @@ -1,7 +1,7 @@ //! Process the potential `cfg` attributes on a module. //! Also determine if the module should be included in this configuration. //! -//! This module properly belongs in syntax_expand, but for now it's tied into +//! This module properly belongs in rustc_expand, but for now it's tied into //! parsing, so we leave it here to avoid complicated out-of-line dependencies. //! //! A principled solution to this wrong location would be to implement [#64197]. diff --git a/src/librustc_passes/Cargo.toml b/src/librustc_passes/Cargo.toml index bb2f7c6741824..ffce0d1cb1a28 100644 --- a/src/librustc_passes/Cargo.toml +++ b/src/librustc_passes/Cargo.toml @@ -17,6 +17,6 @@ rustc_index = { path = "../librustc_index" } rustc_parse = { path = "../librustc_parse" } rustc_target = { path = "../librustc_target" } syntax = { path = "../libsyntax" } -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } errors = { path = "../librustc_errors", package = "rustc_errors" } rustc_error_codes = { path = "../librustc_error_codes" } diff --git a/src/librustc_plugin_impl/Cargo.toml b/src/librustc_plugin_impl/Cargo.toml index d57a58b433f48..05046ae3a0dd6 100644 --- a/src/librustc_plugin_impl/Cargo.toml +++ b/src/librustc_plugin_impl/Cargo.toml @@ -14,5 +14,5 @@ doctest = false rustc = { path = "../librustc" } rustc_metadata = { path = "../librustc_metadata" } syntax = { path = "../libsyntax" } -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } rustc_error_codes = { path = "../librustc_error_codes" } diff --git a/src/librustc_privacy/Cargo.toml b/src/librustc_privacy/Cargo.toml index ef974c77acab7..8a2fbf8974d4b 100644 --- a/src/librustc_privacy/Cargo.toml +++ b/src/librustc_privacy/Cargo.toml @@ -12,7 +12,7 @@ path = "lib.rs" rustc = { path = "../librustc" } rustc_typeck = { path = "../librustc_typeck" } syntax = { path = "../libsyntax" } -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_error_codes = { path = "../librustc_error_codes" } log = "0.4" diff --git a/src/librustc_resolve/Cargo.toml b/src/librustc_resolve/Cargo.toml index caca20e4221e5..0efc0de3a670a 100644 --- a/src/librustc_resolve/Cargo.toml +++ b/src/librustc_resolve/Cargo.toml @@ -14,11 +14,11 @@ doctest = false bitflags = "1.2.1" log = "0.4" syntax = { path = "../libsyntax" } -syntax_expand = { path = "../libsyntax_expand" } +rustc_expand = { path = "../librustc_expand" } rustc = { path = "../librustc" } arena = { path = "../libarena" } errors = { path = "../librustc_errors", package = "rustc_errors" } -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_feature = { path = "../librustc_feature" } rustc_metadata = { path = "../librustc_metadata" } diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index fed4202d96103..388b00e9911b1 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -6,9 +6,9 @@ //! Imports are also considered items and placed into modules here, but not resolved yet. use crate::def_collector::collect_definitions; +use crate::imports::ImportDirective; +use crate::imports::ImportDirectiveSubclass::{self, GlobImport, SingleImport}; use crate::macros::{LegacyBinding, LegacyScope}; -use crate::resolve_imports::ImportDirective; -use crate::resolve_imports::ImportDirectiveSubclass::{self, GlobImport, SingleImport}; use crate::Namespace::{self, MacroNS, TypeNS, ValueNS}; use crate::{CrateLint, Determinacy, PathResult, ResolutionError, VisResolutionError}; use crate::{ @@ -29,6 +29,8 @@ use std::ptr; use errors::Applicability; +use rustc_expand::base::SyntaxExtension; +use rustc_expand::expand::AstFragment; use syntax::ast::{self, Block, ForeignItem, ForeignItemKind, Item, ItemKind, NodeId}; use syntax::ast::{AssocItem, AssocItemKind, MetaItemKind, StmtKind}; use syntax::ast::{Ident, Name}; @@ -38,8 +40,6 @@ use syntax::span_err; use syntax::symbol::{kw, sym}; use syntax::token::{self, Token}; use syntax::visit::{self, Visitor}; -use syntax_expand::base::SyntaxExtension; -use syntax_expand::expand::AstFragment; use syntax_pos::hygiene::{ExpnId, MacroKind}; use syntax_pos::{Span, DUMMY_SP}; diff --git a/src/librustc_resolve/check_unused.rs b/src/librustc_resolve/check_unused.rs index b32a6373742e3..93217aa147713 100644 --- a/src/librustc_resolve/check_unused.rs +++ b/src/librustc_resolve/check_unused.rs @@ -23,7 +23,7 @@ // - `check_crate` finally emits the diagnostics based on the data generated // in the last step -use crate::resolve_imports::ImportDirectiveSubclass; +use crate::imports::ImportDirectiveSubclass; use crate::Resolver; use errors::pluralize; diff --git a/src/librustc_resolve/def_collector.rs b/src/librustc_resolve/def_collector.rs index 2e3eb12d91713..e76f1f82f65ee 100644 --- a/src/librustc_resolve/def_collector.rs +++ b/src/librustc_resolve/def_collector.rs @@ -1,11 +1,11 @@ use log::debug; use rustc::hir::def_id::DefIndex; use rustc::hir::map::definitions::*; +use rustc_expand::expand::AstFragment; use syntax::ast::*; use syntax::symbol::{kw, sym}; use syntax::token::{self, Token}; use syntax::visit; -use syntax_expand::expand::AstFragment; use syntax_pos::hygiene::ExpnId; use syntax_pos::Span; diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index d8a43e8646e51..82b9e5347b7a7 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -19,8 +19,8 @@ use syntax::util::lev_distance::find_best_match_for_name; use syntax_pos::hygiene::MacroKind; use syntax_pos::{BytePos, MultiSpan, Span}; +use crate::imports::{ImportDirective, ImportDirectiveSubclass, ImportResolver}; use crate::path_names_to_string; -use crate::resolve_imports::{ImportDirective, ImportDirectiveSubclass, ImportResolver}; use crate::VisResolutionError; use crate::{BindingError, CrateLint, HasGenericParams, LegacyScope, Module, ModuleOrUniformRoot}; use crate::{ParentScope, PathResult, ResolutionError, Resolver, Scope, ScopeSet, Segment}; diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/imports.rs similarity index 100% rename from src/librustc_resolve/resolve_imports.rs rename to src/librustc_resolve/imports.rs diff --git a/src/librustc_resolve/late.rs b/src/librustc_resolve/late.rs index 898ab6ae32211..ae0a9255497e9 100644 --- a/src/librustc_resolve/late.rs +++ b/src/librustc_resolve/late.rs @@ -3,7 +3,7 @@ //! So it just walks through the crate and resolves all the expressions, types, etc. //! //! If you wonder why there's no `early.rs`, that's because it's split into three files - -//! `build_reduced_graph.rs`, `macros.rs` and `resolve_imports.rs`. +//! `build_reduced_graph.rs`, `macros.rs` and `imports.rs`. use RibKind::*; diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 979489319a5d3..357176ae090ca 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -36,6 +36,7 @@ use rustc::util::nodemap::{DefIdMap, FxHashMap, FxHashSet, NodeMap, NodeSet}; use rustc_metadata::creader::{CStore, CrateLoader}; use errors::{Applicability, DiagnosticBuilder}; +use rustc_expand::base::SyntaxExtension; use syntax::ast::{self, FloatTy, Ident, IntTy, Name, NodeId, UintTy}; use syntax::ast::{Crate, CRATE_NODE_ID}; use syntax::ast::{ItemKind, Path}; @@ -45,7 +46,6 @@ use syntax::source_map::Spanned; use syntax::symbol::{kw, sym}; use syntax::visit::{self, Visitor}; use syntax::{struct_span_err, unwrap_or}; -use syntax_expand::base::SyntaxExtension; use syntax_pos::hygiene::{ExpnId, ExpnKind, MacroKind, SyntaxContext, Transparency}; use syntax_pos::{Span, DUMMY_SP}; @@ -60,9 +60,9 @@ use std::{cmp, fmt, iter, ptr}; use diagnostics::{extend_span_to_previous_binding, find_span_of_binding_until_next_binding}; use diagnostics::{ImportSuggestion, Suggestion}; +use imports::{ImportDirective, ImportDirectiveSubclass, ImportResolver, NameResolution}; use late::{HasGenericParams, PathSource, Rib, RibKind::*}; use macros::{LegacyBinding, LegacyScope}; -use resolve_imports::{ImportDirective, ImportDirectiveSubclass, ImportResolver, NameResolution}; use rustc_error_codes::*; @@ -72,9 +72,9 @@ mod build_reduced_graph; mod check_unused; mod def_collector; mod diagnostics; +mod imports; mod late; mod macros; -mod resolve_imports; enum Weak { Yes, diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index 08a03c6b213e5..d9c3cf0f5f056 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -1,7 +1,7 @@ //! A bunch of methods and structures more or less related to resolving macros and //! interface provided by `Resolver` to macro expander. -use crate::resolve_imports::ImportResolver; +use crate::imports::ImportResolver; use crate::Namespace::*; use crate::{AmbiguityError, AmbiguityErrorMisc, AmbiguityKind, Determinacy}; use crate::{CrateLint, ParentScope, ResolutionError, Resolver, Scope, ScopeSet, Weak}; @@ -12,16 +12,16 @@ use rustc::middle::stability; use rustc::session::Session; use rustc::util::nodemap::FxHashSet; use rustc::{lint, span_bug, ty}; +use rustc_expand::base::SyntaxExtension; +use rustc_expand::base::{self, Indeterminate, InvocationRes}; +use rustc_expand::compile_declarative_macro; +use rustc_expand::expand::{AstFragment, AstFragmentKind, Invocation, InvocationKind}; use rustc_feature::is_builtin_attr_name; use syntax::ast::{self, Ident, NodeId}; use syntax::attr::{self, StabilityLevel}; use syntax::edition::Edition; use syntax::feature_gate::feature_err; use syntax::print::pprust; -use syntax_expand::base::SyntaxExtension; -use syntax_expand::base::{self, Indeterminate, InvocationRes}; -use syntax_expand::compile_declarative_macro; -use syntax_expand::expand::{AstFragment, AstFragmentKind, Invocation, InvocationKind}; use syntax_pos::hygiene::{self, ExpnData, ExpnId, ExpnKind}; use syntax_pos::symbol::{kw, sym, Symbol}; use syntax_pos::{Span, DUMMY_SP}; diff --git a/src/librustc_save_analysis/Cargo.toml b/src/librustc_save_analysis/Cargo.toml index 50b3be6dca1c3..7570944a4354c 100644 --- a/src/librustc_save_analysis/Cargo.toml +++ b/src/librustc_save_analysis/Cargo.toml @@ -16,6 +16,6 @@ rustc_codegen_utils = { path = "../librustc_codegen_utils" } rustc_parse = { path = "../librustc_parse" } serde_json = "1" syntax = { path = "../libsyntax" } -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } rls-data = "0.19" rls-span = "0.5" diff --git a/src/librustc_session/Cargo.toml b/src/librustc_session/Cargo.toml index dbbb4b92dea35..847a368d4cf55 100644 --- a/src/librustc_session/Cargo.toml +++ b/src/librustc_session/Cargo.toml @@ -15,7 +15,7 @@ rustc_feature = { path = "../librustc_feature" } rustc_target = { path = "../librustc_target" } rustc_serialize = { path = "../libserialize", package = "serialize" } rustc_data_structures = { path = "../librustc_data_structures" } -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } rustc_index = { path = "../librustc_index" } rustc_fs_util = { path = "../librustc_fs_util" } num_cpus = "1.0" diff --git a/src/libsyntax_pos/Cargo.toml b/src/librustc_span/Cargo.toml similarity index 92% rename from src/libsyntax_pos/Cargo.toml rename to src/librustc_span/Cargo.toml index 2cac76085d297..c3fa2331d2b16 100644 --- a/src/libsyntax_pos/Cargo.toml +++ b/src/librustc_span/Cargo.toml @@ -1,11 +1,11 @@ [package] authors = ["The Rust Project Developers"] -name = "syntax_pos" +name = "rustc_span" version = "0.0.0" edition = "2018" [lib] -name = "syntax_pos" +name = "rustc_span" path = "lib.rs" doctest = false diff --git a/src/libsyntax_pos/analyze_source_file.rs b/src/librustc_span/analyze_source_file.rs similarity index 100% rename from src/libsyntax_pos/analyze_source_file.rs rename to src/librustc_span/analyze_source_file.rs diff --git a/src/libsyntax_pos/analyze_source_file/tests.rs b/src/librustc_span/analyze_source_file/tests.rs similarity index 100% rename from src/libsyntax_pos/analyze_source_file/tests.rs rename to src/librustc_span/analyze_source_file/tests.rs diff --git a/src/libsyntax_pos/caching_source_map_view.rs b/src/librustc_span/caching_source_map_view.rs similarity index 100% rename from src/libsyntax_pos/caching_source_map_view.rs rename to src/librustc_span/caching_source_map_view.rs diff --git a/src/libsyntax_pos/edition.rs b/src/librustc_span/edition.rs similarity index 100% rename from src/libsyntax_pos/edition.rs rename to src/librustc_span/edition.rs diff --git a/src/libsyntax_pos/fatal_error.rs b/src/librustc_span/fatal_error.rs similarity index 100% rename from src/libsyntax_pos/fatal_error.rs rename to src/librustc_span/fatal_error.rs diff --git a/src/libsyntax_pos/hygiene.rs b/src/librustc_span/hygiene.rs similarity index 100% rename from src/libsyntax_pos/hygiene.rs rename to src/librustc_span/hygiene.rs diff --git a/src/libsyntax_pos/lib.rs b/src/librustc_span/lib.rs similarity index 100% rename from src/libsyntax_pos/lib.rs rename to src/librustc_span/lib.rs diff --git a/src/libsyntax_pos/source_map.rs b/src/librustc_span/source_map.rs similarity index 100% rename from src/libsyntax_pos/source_map.rs rename to src/librustc_span/source_map.rs diff --git a/src/libsyntax_pos/source_map/tests.rs b/src/librustc_span/source_map/tests.rs similarity index 100% rename from src/libsyntax_pos/source_map/tests.rs rename to src/librustc_span/source_map/tests.rs diff --git a/src/libsyntax_pos/span_encoding.rs b/src/librustc_span/span_encoding.rs similarity index 100% rename from src/libsyntax_pos/span_encoding.rs rename to src/librustc_span/span_encoding.rs diff --git a/src/libsyntax_pos/symbol.rs b/src/librustc_span/symbol.rs similarity index 100% rename from src/libsyntax_pos/symbol.rs rename to src/librustc_span/symbol.rs diff --git a/src/libsyntax_pos/symbol/tests.rs b/src/librustc_span/symbol/tests.rs similarity index 100% rename from src/libsyntax_pos/symbol/tests.rs rename to src/librustc_span/symbol/tests.rs diff --git a/src/libsyntax_pos/tests.rs b/src/librustc_span/tests.rs similarity index 100% rename from src/libsyntax_pos/tests.rs rename to src/librustc_span/tests.rs diff --git a/src/librustc_target/Cargo.toml b/src/librustc_target/Cargo.toml index 0e0732490fbbd..8b60bde4dc42b 100644 --- a/src/librustc_target/Cargo.toml +++ b/src/librustc_target/Cargo.toml @@ -14,5 +14,5 @@ log = "0.4" rustc_data_structures = { path = "../librustc_data_structures" } rustc_macros = { path = "../librustc_macros" } rustc_serialize = { path = "../libserialize", package = "serialize" } -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } rustc_index = { path = "../librustc_index" } diff --git a/src/librustc_traits/Cargo.toml b/src/librustc_traits/Cargo.toml index fab177139dc1b..5573b4bc84060 100644 --- a/src/librustc_traits/Cargo.toml +++ b/src/librustc_traits/Cargo.toml @@ -15,6 +15,6 @@ rustc_data_structures = { path = "../librustc_data_structures" } rustc_macros = { path = "../librustc_macros" } rustc_target = { path = "../librustc_target" } syntax = { path = "../libsyntax" } -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } chalk-engine = { version = "0.9.0", default-features=false } smallvec = { version = "1.0", features = ["union", "may_dangle"] } diff --git a/src/librustc_typeck/Cargo.toml b/src/librustc_typeck/Cargo.toml index a78eba7c0b793..bf1932ccf26d6 100644 --- a/src/librustc_typeck/Cargo.toml +++ b/src/librustc_typeck/Cargo.toml @@ -19,6 +19,6 @@ errors = { path = "../librustc_errors", package = "rustc_errors" } rustc_target = { path = "../librustc_target" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } syntax = { path = "../libsyntax" } -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } rustc_index = { path = "../librustc_index" } rustc_error_codes = { path = "../librustc_error_codes" } diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 0b4abe0a22e3b..fb289f8ab8a27 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -25,6 +25,7 @@ extern crate rustc; extern crate rustc_data_structures; extern crate rustc_driver; extern crate rustc_error_codes; +extern crate rustc_expand; extern crate rustc_feature; extern crate rustc_index; extern crate rustc_interface; @@ -33,11 +34,10 @@ extern crate rustc_lint; extern crate rustc_metadata; extern crate rustc_parse; extern crate rustc_resolve; +extern crate rustc_span as syntax_pos; extern crate rustc_target; extern crate rustc_typeck; extern crate syntax; -extern crate syntax_expand; -extern crate syntax_pos; extern crate test as testing; #[macro_use] extern crate log; diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index af850a3446799..75a87e7cc5dd9 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -8,12 +8,12 @@ use rustc::hir::def::{ use rustc::hir::def_id::DefId; use rustc::lint; use rustc::ty; +use rustc_expand::base::SyntaxExtensionKind; use rustc_feature::UnstableFeatures; use rustc_resolve::ParentScope; use syntax; use syntax::ast::{self, Ident}; use syntax::symbol::Symbol; -use syntax_expand::base::SyntaxExtensionKind; use syntax_pos::DUMMY_SP; use std::ops::Range; diff --git a/src/libsyntax/Cargo.toml b/src/libsyntax/Cargo.toml index 8a00bcbfe17c7..de35f1744c1fb 100644 --- a/src/libsyntax/Cargo.toml +++ b/src/libsyntax/Cargo.toml @@ -15,7 +15,7 @@ rustc_serialize = { path = "../libserialize", package = "serialize" } log = "0.4" scoped-tls = "1.0" lazy_static = "1.0.0" -syntax_pos = { path = "../libsyntax_pos" } +syntax_pos = { path = "../librustc_span", package = "rustc_span" } errors = { path = "../librustc_errors", package = "rustc_errors" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_feature = { path = "../librustc_feature" } diff --git a/src/test/ui-fulldeps/auxiliary/macro-crate-test.rs b/src/test/ui-fulldeps/auxiliary/macro-crate-test.rs index ee82c0adc8604..fa136fd54c26b 100644 --- a/src/test/ui-fulldeps/auxiliary/macro-crate-test.rs +++ b/src/test/ui-fulldeps/auxiliary/macro-crate-test.rs @@ -7,7 +7,6 @@ extern crate syntax; extern crate rustc; extern crate rustc_driver; -extern crate syntax_pos; extern crate proc_macro; use proc_macro::{TokenTree, TokenStream}; diff --git a/src/test/ui-fulldeps/mod_dir_path_canonicalized.rs b/src/test/ui-fulldeps/mod_dir_path_canonicalized.rs index cf675831cfe06..51aa5f24e4ce9 100644 --- a/src/test/ui-fulldeps/mod_dir_path_canonicalized.rs +++ b/src/test/ui-fulldeps/mod_dir_path_canonicalized.rs @@ -5,7 +5,6 @@ #![feature(rustc_private)] extern crate syntax; -extern crate syntax_expand; extern crate rustc_parse; use rustc_parse::new_parser_from_file; diff --git a/src/test/ui-fulldeps/pprust-expr-roundtrip.rs b/src/test/ui-fulldeps/pprust-expr-roundtrip.rs index 36d47cea13b07..59813322e5b25 100644 --- a/src/test/ui-fulldeps/pprust-expr-roundtrip.rs +++ b/src/test/ui-fulldeps/pprust-expr-roundtrip.rs @@ -21,7 +21,6 @@ extern crate rustc_data_structures; extern crate syntax; -extern crate syntax_expand; extern crate rustc_parse; use rustc_data_structures::thin_vec::ThinVec;