Skip to content

Commit

Permalink
Auto merge of #67707 - petrochenkov:crateren, r=Centril
Browse files Browse the repository at this point in the history
Rename some crates and modules in the frontend

Migrate from `syntax_*` naming scheme to `rustc_*`.
See #65324 (comment) and several comments below.

Renamed crates:
`syntax_expand` -> `rustc_expand`
`syntax_pos` -> `rustc_span` ([motivation](#65324 (comment)))
`syntax_ext` -> `rustc_builtin_macros`

Also one module in resolve is renamed for consistency and to avoid tautology.

r? @Centril
  • Loading branch information
bors committed Dec 30, 2019
2 parents 9d6f871 + 7608f21 commit a9dd56f
Show file tree
Hide file tree
Showing 113 changed files with 195 additions and 198 deletions.
156 changes: 78 additions & 78 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/libfmt_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
2 changes: 1 addition & 1 deletion src/librustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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" }
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
use State::*;

use errors::{DiagnosticBuilder, PResult};
use rustc_expand::base::*;
use rustc_parse::parser::Parser;
use syntax::ast::{self, AsmDialect};
use syntax::ptr::P;
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::*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use errors::{Applicability, DiagnosticBuilder};

use rustc_expand::base::*;
use rustc_parse::parser::Parser;
use syntax::ast::{self, *};
use syntax::print::pprust;
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>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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>(
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use crate::deriving::generic::ty::*;
use crate::deriving::generic::*;
use crate::deriving::path_std;

use rustc_expand::base::{Annotatable, ExtCtxt};
use syntax::ast::MetaItem;
use syntax_expand::base::{Annotatable, ExtCtxt};
use syntax_pos::Span;

pub fn expand_deriving_copy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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};
Expand Down Expand Up @@ -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;
}
};
Expand Down Expand Up @@ -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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down Expand Up @@ -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;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit a9dd56f

Please sign in to comment.