Skip to content

Commit 7e8599d

Browse files
authored
Rollup merge of rust-lang#65792 - Centril:split-syntax-2, r=petrochenkov
rustc, rustc_passes: reduce deps on rustc_expand Part of rust-lang#65324. r? @petrochenkov
2 parents af6b43a + fb12c70 commit 7e8599d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+130
-123
lines changed

Cargo.lock

-3
Original file line numberDiff line numberDiff line change
@@ -3135,7 +3135,6 @@ dependencies = [
31353135
"serialize",
31363136
"smallvec",
31373137
"syntax",
3138-
"syntax_expand",
31393138
"syntax_pos",
31403139
]
31413140

@@ -3451,7 +3450,6 @@ dependencies = [
34513450
"rustc_target",
34523451
"serialize",
34533452
"syntax",
3454-
"syntax_expand",
34553453
"syntax_pos",
34563454
"tempfile",
34573455
]
@@ -3707,7 +3705,6 @@ dependencies = [
37073705
"rustc_index",
37083706
"rustc_target",
37093707
"syntax",
3710-
"syntax_expand",
37113708
"syntax_pos",
37123709
]
37133710

src/librustc/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ rustc_index = { path = "../librustc_index" }
2929
errors = { path = "../librustc_errors", package = "rustc_errors" }
3030
rustc_serialize = { path = "../libserialize", package = "serialize" }
3131
syntax = { path = "../libsyntax" }
32-
syntax_expand = { path = "../libsyntax_expand" }
3332
syntax_pos = { path = "../libsyntax_pos" }
3433
backtrace = "0.3.3"
3534
parking_lot = "0.9"

src/librustc/hir/def.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use crate::ty;
66
use crate::util::nodemap::DefIdMap;
77

88
use syntax::ast;
9-
use syntax_expand::base::MacroKind;
109
use syntax::ast::NodeId;
10+
use syntax_pos::hygiene::MacroKind;
1111
use syntax_pos::Span;
1212
use rustc_macros::HashStable;
1313

src/librustc/hir/lowering.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ use syntax::ast;
6464
use syntax::ptr::P as AstP;
6565
use syntax::ast::*;
6666
use syntax::errors;
67-
use syntax_expand::base::SpecialDerives;
67+
use syntax::expand::SpecialDerives;
6868
use syntax::print::pprust;
6969
use syntax::parse::token::{self, Nonterminal, Token};
7070
use syntax::tokenstream::{TokenStream, TokenTree};

src/librustc/hir/lowering/item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use smallvec::SmallVec;
1818
use syntax::attr;
1919
use syntax::ast::*;
2020
use syntax::visit::{self, Visitor};
21-
use syntax_expand::base::SpecialDerives;
21+
use syntax::expand::SpecialDerives;
2222
use syntax::source_map::{respan, DesugaringKind, Spanned};
2323
use syntax::symbol::{kw, sym};
2424
use syntax_pos::Span;

src/librustc/hir/map/def_collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ use crate::hir::map::definitions::*;
22
use crate::hir::def_id::DefIndex;
33

44
use syntax::ast::*;
5-
use syntax_expand::hygiene::ExpnId;
65
use syntax::visit;
76
use syntax::symbol::{kw, sym};
87
use syntax::parse::token::{self, Token};
8+
use syntax_pos::hygiene::ExpnId;
99
use syntax_pos::Span;
1010

1111
/// Creates `DefId`s for nodes in the AST.

src/librustc/hir/map/definitions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ use std::borrow::Borrow;
1717
use std::fmt::Write;
1818
use std::hash::Hash;
1919
use syntax::ast;
20-
use syntax_expand::hygiene::ExpnId;
21-
use syntax::symbol::{Symbol, sym};
20+
use syntax_pos::symbol::{Symbol, sym};
21+
use syntax_pos::hygiene::ExpnId;
2222
use syntax_pos::{Span, DUMMY_SP};
2323

2424
/// The `DefPathTable` maps `DefIndex`es to `DefKey`s and vice versa.

src/librustc/hir/map/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_data_structures::svh::Svh;
2020
use rustc_index::vec::IndexVec;
2121
use syntax::ast::{self, Name, NodeId};
2222
use syntax::source_map::Spanned;
23-
use syntax_expand::base::MacroKind;
23+
use syntax_pos::hygiene::MacroKind;
2424
use syntax_pos::{Span, DUMMY_SP};
2525

2626
pub mod blocks;

src/librustc/ich/hcx.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ use std::cell::RefCell;
1313

1414
use syntax::ast;
1515
use syntax::source_map::SourceMap;
16-
use syntax_expand::hygiene::SyntaxContext;
1716
use syntax::symbol::Symbol;
1817
use syntax::tokenstream::DelimSpan;
1918
use syntax_pos::{Span, DUMMY_SP};
20-
use syntax_pos::hygiene;
19+
use syntax_pos::hygiene::{self, SyntaxContext};
2120

2221
use rustc_data_structures::stable_hasher::{
2322
HashStable, StableHasher, ToStableHashKey,

src/librustc/ich/impls_syntax.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl_stable_hash_for!(enum ::syntax::ast::AsmDialect {
6060
Intel
6161
});
6262

63-
impl_stable_hash_for!(enum ::syntax_expand::base::MacroKind {
63+
impl_stable_hash_for!(enum ::syntax_pos::hygiene::MacroKind {
6464
Bang,
6565
Attr,
6666
Derive,

src/librustc/lint/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ use syntax::ast;
3939
use syntax::source_map::{MultiSpan, ExpnKind, DesugaringKind};
4040
use syntax::early_buffered_lints::BufferedEarlyLintId;
4141
use syntax::edition::Edition;
42-
use syntax_expand::base::MacroKind;
4342
use syntax::symbol::{Symbol, sym};
43+
use syntax_pos::hygiene::MacroKind;
4444
use syntax_pos::Span;
4545

4646
pub use crate::lint::context::{LateContext, EarlyContext, LintContext, LintStore,

src/librustc/session/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use errors::emitter::HumanReadableErrorType;
2424
use errors::annotate_snippet_emitter_writer::{AnnotateSnippetEmitterWriter};
2525
use syntax::ast::{self, NodeId};
2626
use syntax::edition::Edition;
27-
use syntax_expand::allocator::AllocatorKind;
27+
use syntax::expand::allocator::AllocatorKind;
2828
use syntax::feature_gate::{self, AttributeType};
2929
use syntax::json::JsonEmitter;
3030
use syntax::source_map;

src/librustc/ty/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ use std::{mem, ptr};
4646
use std::ops::Range;
4747
use syntax::ast::{self, Name, Ident, NodeId};
4848
use syntax::attr;
49-
use syntax_expand::hygiene::ExpnId;
50-
use syntax::symbol::{kw, sym, Symbol};
49+
use syntax_pos::symbol::{kw, sym, Symbol};
50+
use syntax_pos::hygiene::ExpnId;
5151
use syntax_pos::Span;
5252

5353
use smallvec;

src/librustc_codegen_llvm/allocator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::ffi::CString;
33
use crate::attributes;
44
use libc::c_uint;
55
use rustc::ty::TyCtxt;
6-
use syntax_expand::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS};
6+
use syntax::expand::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS};
77

88
use crate::ModuleLlvm;
99
use crate::llvm::{self, False, True};

src/librustc_codegen_llvm/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ extern crate rustc_driver as _;
3939

4040
#[macro_use] extern crate log;
4141
extern crate syntax;
42-
extern crate syntax_expand;
4342
extern crate syntax_pos;
4443
extern crate rustc_errors as errors;
4544

@@ -49,7 +48,7 @@ use rustc_codegen_ssa::back::lto::{SerializedModule, LtoModuleCodegen, ThinModul
4948
use rustc_codegen_ssa::CompiledModule;
5049
use errors::{FatalError, Handler};
5150
use rustc::dep_graph::WorkProduct;
52-
use syntax_expand::allocator::AllocatorKind;
51+
use syntax::expand::allocator::AllocatorKind;
5352
pub use llvm_util::target_features;
5453
use std::any::Any;
5554
use std::sync::Arc;

src/librustc_codegen_ssa/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ tempfile = "3.1"
2121

2222
rustc_serialize = { path = "../libserialize", package = "serialize" }
2323
syntax = { path = "../libsyntax" }
24-
syntax_expand = { path = "../libsyntax_expand" }
2524
syntax_pos = { path = "../libsyntax_pos" }
2625
rustc = { path = "../librustc" }
2726
rustc_apfloat = { path = "../librustc_apfloat" }

src/librustc_codegen_ssa/back/symbol_export.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc::ty::query::Providers;
1414
use rustc::ty::subst::SubstsRef;
1515
use rustc::util::nodemap::{FxHashMap, DefIdMap};
1616
use rustc_index::vec::IndexVec;
17-
use syntax_expand::allocator::ALLOCATOR_METHODS;
17+
use syntax::expand::allocator::ALLOCATOR_METHODS;
1818

1919
pub type ExportedSymbols = FxHashMap<
2020
CrateNum,

src/librustc_codegen_ssa/back/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use rustc_errors::{Handler, Level, FatalError, DiagnosticId, SourceMapperDyn};
2727
use rustc_errors::emitter::{Emitter};
2828
use rustc_target::spec::MergeFunctions;
2929
use syntax::attr;
30-
use syntax_expand::hygiene::ExpnId;
30+
use syntax_pos::hygiene::ExpnId;
3131
use syntax_pos::symbol::{Symbol, sym};
3232
use jobserver::{Client, Acquired};
3333

src/librustc_codegen_ssa/traits/backend.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc::ty::TyCtxt;
99
use rustc_codegen_utils::codegen_backend::CodegenBackend;
1010
use std::sync::Arc;
1111
use std::sync::mpsc;
12-
use syntax_expand::allocator::AllocatorKind;
12+
use syntax::expand::allocator::AllocatorKind;
1313
use syntax_pos::symbol::Symbol;
1414

1515
pub trait BackendTypes {

src/librustc_interface/passes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ pub fn lower_to_hir(
502502

503503
// Discard hygiene data, which isn't required after lowering to HIR.
504504
if !sess.opts.debugging_opts.keep_hygiene_data {
505-
syntax_expand::hygiene::clear_syntax_context_map();
505+
syntax_pos::hygiene::clear_syntax_context_map();
506506
}
507507

508508
Ok(hir_forest)

src/librustc_metadata/creader.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use std::{cmp, fs};
2525

2626
use syntax::ast;
2727
use syntax::attr;
28-
use syntax_expand::allocator::{global_allocator_spans, AllocatorKind};
28+
use syntax::expand::allocator::{global_allocator_spans, AllocatorKind};
2929
use syntax::symbol::{Symbol, sym};
3030
use syntax::span_fatal;
3131
use syntax_pos::{Span, DUMMY_SP};

src/librustc_metadata/decoder.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ use rustc_serialize::{Decodable, Decoder, Encodable, SpecializedDecoder, opaque}
3333
use syntax::attr;
3434
use syntax::ast::{self, Ident};
3535
use syntax::source_map::{self, respan, Spanned};
36-
use syntax::symbol::{Symbol, sym};
37-
use syntax_expand::base::{MacroKind, SyntaxExtensionKind, SyntaxExtension};
38-
use syntax_pos::{self, Span, BytePos, Pos, DUMMY_SP};
36+
use syntax_expand::base::{SyntaxExtensionKind, SyntaxExtension};
37+
use syntax_expand::proc_macro::{AttrProcMacro, ProcMacroDerive, BangProcMacro};
38+
use syntax_pos::{self, Span, BytePos, Pos, DUMMY_SP, hygiene::MacroKind};
39+
use syntax_pos::symbol::{Symbol, sym};
3940
use log::debug;
4041
use proc_macro::bridge::client::ProcMacro;
41-
use syntax_expand::proc_macro::{AttrProcMacro, ProcMacroDerive, BangProcMacro};
4242

4343
crate struct DecodeContext<'a, 'tcx> {
4444
opaque: opaque::Decoder<'a>,

src/librustc_metadata/encoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use std::path::Path;
3232
use std::u32;
3333
use syntax::ast;
3434
use syntax::attr;
35-
use syntax_expand::proc_macro::is_proc_macro_attr;
35+
use syntax::expand::is_proc_macro_attr;
3636
use syntax::source_map::Spanned;
3737
use syntax::symbol::{kw, sym, Ident, Symbol};
3838
use syntax_pos::{self, FileName, SourceFile, Span};

src/librustc_passes/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ log = "0.4"
1313
rustc = { path = "../librustc" }
1414
rustc_data_structures = { path = "../librustc_data_structures" }
1515
syntax = { path = "../libsyntax" }
16-
syntax_expand = { path = "../libsyntax_expand" }
1716
syntax_pos = { path = "../libsyntax_pos" }
1817
errors = { path = "../librustc_errors", package = "rustc_errors" }
1918
rustc_target = { path = "../librustc_target" }

src/librustc_passes/ast_validation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc::session::Session;
1414
use rustc_data_structures::fx::FxHashMap;
1515
use syntax::ast::*;
1616
use syntax::attr;
17-
use syntax_expand::proc_macro::is_proc_macro_attr;
17+
use syntax::expand::is_proc_macro_attr;
1818
use syntax::feature_gate::is_builtin_attr;
1919
use syntax::source_map::Spanned;
2020
use syntax::symbol::{kw, sym};

src/librustc_resolve/build_reduced_graph.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,16 @@ use syntax::attr;
3232

3333
use syntax::ast::{self, Block, ForeignItem, ForeignItemKind, Item, ItemKind, NodeId};
3434
use syntax::ast::{MetaItemKind, StmtKind, TraitItem, TraitItemKind};
35-
use syntax_expand::base::{MacroKind, SyntaxExtension};
36-
use syntax_expand::expand::AstFragment;
37-
use syntax_expand::hygiene::ExpnId;
3835
use syntax::feature_gate::is_builtin_attr;
3936
use syntax::parse::token::{self, Token};
4037
use syntax::print::pprust;
4138
use syntax::{span_err, struct_span_err};
4239
use syntax::source_map::{respan, Spanned};
4340
use syntax::symbol::{kw, sym};
4441
use syntax::visit::{self, Visitor};
45-
42+
use syntax_expand::base::SyntaxExtension;
43+
use syntax_expand::expand::AstFragment;
44+
use syntax_pos::hygiene::{MacroKind, ExpnId};
4645
use syntax_pos::{Span, DUMMY_SP};
4746

4847
use log::debug;

src/librustc_resolve/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ use rustc::session::Session;
1010
use rustc::ty::{self, DefIdTree};
1111
use rustc::util::nodemap::FxHashSet;
1212
use syntax::ast::{self, Ident, Path};
13-
use syntax_expand::base::MacroKind;
1413
use syntax::feature_gate::BUILTIN_ATTRIBUTES;
1514
use syntax::source_map::SourceMap;
1615
use syntax::struct_span_err;
1716
use syntax::symbol::{Symbol, kw};
1817
use syntax::util::lev_distance::find_best_match_for_name;
18+
use syntax_pos::hygiene::MacroKind;
1919
use syntax_pos::{BytePos, Span, MultiSpan};
2020

2121
use crate::resolve_imports::{ImportDirective, ImportDirectiveSubclass, ImportResolver};

src/librustc_resolve/late/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ use rustc::hir::PrimTy;
1313
use rustc::session::config::nightly_options;
1414
use rustc::util::nodemap::FxHashSet;
1515
use syntax::ast::{self, Expr, ExprKind, Ident, NodeId, Path, Ty, TyKind};
16-
use syntax_expand::base::MacroKind;
1716
use syntax::symbol::kw;
1817
use syntax::util::lev_distance::find_best_match_for_name;
18+
use syntax_pos::hygiene::MacroKind;
1919
use syntax_pos::Span;
2020

2121
type Res = def::Res<ast::NodeId>;

src/librustc_resolve/lib.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,18 @@ use rustc::span_bug;
3535
use rustc_metadata::creader::CrateLoader;
3636
use rustc_metadata::cstore::CStore;
3737

38-
use syntax_expand::hygiene::{ExpnId, Transparency, SyntaxContext};
39-
use syntax_expand::base::{SyntaxExtension, MacroKind, SpecialDerives};
4038
use syntax::{struct_span_err, unwrap_or};
41-
use syntax::attr;
39+
use syntax::expand::SpecialDerives;
4240
use syntax::ast::{self, Name, NodeId, Ident, FloatTy, IntTy, UintTy};
43-
use syntax::ast::{ItemKind, Path, CRATE_NODE_ID, Crate};
41+
use syntax::ast::{CRATE_NODE_ID, Crate};
42+
use syntax::ast::{ItemKind, Path};
43+
use syntax::attr;
4444
use syntax::print::pprust;
4545
use syntax::symbol::{kw, sym};
4646
use syntax::source_map::Spanned;
4747
use syntax::visit::{self, Visitor};
48-
48+
use syntax_expand::base::SyntaxExtension;
49+
use syntax_pos::hygiene::{MacroKind, ExpnId, Transparency, SyntaxContext};
4950
use syntax_pos::{Span, DUMMY_SP};
5051
use errors::{Applicability, DiagnosticBuilder};
5152

src/librustc_resolve/macros.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,21 @@ use rustc::{ty, lint, span_bug};
1414
use syntax::ast::{self, NodeId, Ident};
1515
use syntax::attr::StabilityLevel;
1616
use syntax::edition::Edition;
17-
use syntax_expand::base::{self, InvocationRes, Indeterminate, SpecialDerives};
18-
use syntax_expand::base::{MacroKind, SyntaxExtension};
19-
use syntax_expand::expand::{AstFragment, AstFragmentKind, Invocation, InvocationKind};
20-
use syntax_expand::hygiene::{self, ExpnId, ExpnData, ExpnKind};
21-
use syntax_expand::compile_declarative_macro;
17+
use syntax::expand::SpecialDerives;
2218
use syntax::feature_gate::{emit_feature_err, is_builtin_attr_name};
2319
use syntax::feature_gate::GateIssue;
2420
use syntax::print::pprust;
2521
use syntax::symbol::{Symbol, kw, sym};
22+
use syntax_expand::base::{self, InvocationRes, Indeterminate};
23+
use syntax_expand::base::SyntaxExtension;
24+
use syntax_expand::expand::{AstFragment, AstFragmentKind, Invocation, InvocationKind};
25+
use syntax_expand::compile_declarative_macro;
26+
use syntax_pos::hygiene::{self, ExpnId, ExpnData, ExpnKind};
2627
use syntax_pos::{Span, DUMMY_SP};
2728

2829
use std::{mem, ptr};
2930
use rustc_data_structures::sync::Lrc;
30-
use syntax_pos::hygiene::AstPass;
31+
use syntax_pos::hygiene::{MacroKind, AstPass};
3132

3233
type Res = def::Res<NodeId>;
3334

src/librustc_resolve/resolve_imports.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ use rustc::util::nodemap::FxHashSet;
2828
use rustc::{bug, span_bug};
2929

3030
use syntax::ast::{Ident, Name, NodeId, CRATE_NODE_ID};
31-
use syntax_expand::hygiene::ExpnId;
3231
use syntax::symbol::kw;
3332
use syntax::util::lev_distance::find_best_match_for_name;
3433
use syntax::{struct_span_err, unwrap_or};
34+
use syntax_pos::hygiene::ExpnId;
3535
use syntax_pos::{MultiSpan, Span};
3636

3737
use log::*;

src/librustdoc/clean/inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
use std::iter::once;
44

55
use syntax::ast;
6-
use syntax_expand::base::MacroKind;
76
use syntax::symbol::sym;
7+
use syntax_pos::hygiene::MacroKind;
88
use syntax_pos::Span;
99

1010
use rustc::hir;

src/librustdoc/clean/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ use rustc::ty::layout::VariantIdx;
2828
use rustc::util::nodemap::{FxHashMap, FxHashSet};
2929
use syntax::ast::{self, Attribute, AttrStyle, AttrItem, Ident};
3030
use syntax::attr;
31-
use syntax_expand::base::MacroKind;
3231
use syntax::parse::lexer::comments;
3332
use syntax::source_map::DUMMY_SP;
34-
use syntax::symbol::{Symbol, kw, sym};
33+
use syntax_pos::symbol::{Symbol, kw, sym};
34+
use syntax_pos::hygiene::MacroKind;
3535
use syntax_pos::{self, Pos, FileName};
3636

3737
use std::collections::hash_map::Entry;

0 commit comments

Comments
 (0)