Skip to content

Commit 8fad976

Browse files
authored
Rollup merge of rust-lang#62771 - petrochenkov:depext, r=eddyb
Break dependencies between `syntax_ext` and other crates Move `source_util` macros into `syntax_ext`. Move other early code generation facilities like standard library injection into `syntax_ext`. The only crate that depends on `syntax_ext` now is `rustc_interface` which is one of the "final" crates that depend on everything. Minor: Cleanup dependencies of `rustc_driver`, many of them are no longer used after introduction of `rustc_interface`. r? @eddyb
2 parents 966ba8d + ec5f089 commit 8fad976

Some content is hidden

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

44 files changed

+457
-664
lines changed

Cargo.lock

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2751,20 +2751,6 @@ dependencies = [
27512751
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
27522752
]
27532753

2754-
[[package]]
2755-
name = "rustc_allocator"
2756-
version = "0.0.0"
2757-
dependencies = [
2758-
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
2759-
"rustc 0.0.0",
2760-
"rustc_data_structures 0.0.0",
2761-
"rustc_errors 0.0.0",
2762-
"rustc_target 0.0.0",
2763-
"smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
2764-
"syntax 0.0.0",
2765-
"syntax_pos 0.0.0",
2766-
]
2767-
27682754
[[package]]
27692755
name = "rustc_apfloat"
27702756
version = "0.0.0"
@@ -2822,7 +2808,6 @@ dependencies = [
28222808
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
28232809
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
28242810
"rustc 0.0.0",
2825-
"rustc_allocator 0.0.0",
28262811
"rustc_apfloat 0.0.0",
28272812
"rustc_codegen_utils 0.0.0",
28282813
"rustc_data_structures 0.0.0",
@@ -2877,34 +2862,21 @@ dependencies = [
28772862
name = "rustc_driver"
28782863
version = "0.0.0"
28792864
dependencies = [
2880-
"arena 0.0.0",
28812865
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
28822866
"graphviz 0.0.0",
28832867
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
28842868
"rustc 0.0.0",
2885-
"rustc-rayon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
2886-
"rustc_allocator 0.0.0",
28872869
"rustc_ast_borrowck 0.0.0",
28882870
"rustc_codegen_utils 0.0.0",
28892871
"rustc_data_structures 0.0.0",
28902872
"rustc_errors 0.0.0",
2891-
"rustc_incremental 0.0.0",
28922873
"rustc_interface 0.0.0",
2893-
"rustc_lint 0.0.0",
28942874
"rustc_metadata 0.0.0",
28952875
"rustc_mir 0.0.0",
2896-
"rustc_passes 0.0.0",
2897-
"rustc_plugin 0.0.0",
2898-
"rustc_privacy 0.0.0",
2899-
"rustc_resolve 0.0.0",
29002876
"rustc_save_analysis 0.0.0",
29012877
"rustc_target 0.0.0",
2902-
"rustc_traits 0.0.0",
2903-
"rustc_typeck 0.0.0",
29042878
"serialize 0.0.0",
2905-
"smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
29062879
"syntax 0.0.0",
2907-
"syntax_ext 0.0.0",
29082880
"syntax_pos 0.0.0",
29092881
]
29102882

@@ -2948,7 +2920,6 @@ dependencies = [
29482920
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
29492921
"rustc 0.0.0",
29502922
"rustc-rayon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
2951-
"rustc_allocator 0.0.0",
29522923
"rustc_ast_borrowck 0.0.0",
29532924
"rustc_codegen_ssa 0.0.0",
29542925
"rustc_codegen_utils 0.0.0",
@@ -3036,7 +3007,6 @@ dependencies = [
30363007
"smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
30373008
"stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
30383009
"syntax 0.0.0",
3039-
"syntax_ext 0.0.0",
30403010
"syntax_pos 0.0.0",
30413011
]
30423012

@@ -3081,9 +3051,7 @@ dependencies = [
30813051
"rustc 0.0.0",
30823052
"rustc_data_structures 0.0.0",
30833053
"rustc_errors 0.0.0",
3084-
"rustc_mir 0.0.0",
30853054
"syntax 0.0.0",
3086-
"syntax_ext 0.0.0",
30873055
"syntax_pos 0.0.0",
30883056
]
30893057

src/librustc/hir/lowering.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ use syntax::errors;
6363
use syntax::ext::hygiene::ExpnId;
6464
use syntax::print::pprust;
6565
use syntax::source_map::{respan, ExpnInfo, ExpnKind, DesugaringKind, Spanned};
66-
use syntax::std_inject;
6766
use syntax::symbol::{kw, sym, Symbol};
6867
use syntax::tokenstream::{TokenStream, TokenTree};
6968
use syntax::parse::token::{self, Token};
@@ -241,7 +240,7 @@ pub fn lower_crate(
241240
dep_graph.assert_ignored();
242241

243242
LoweringContext {
244-
crate_root: std_inject::injected_crate_name().map(Symbol::intern),
243+
crate_root: sess.parse_sess.injected_crate_name.try_get().copied(),
245244
sess,
246245
cstore,
247246
resolver,

src/librustc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ pub mod infer;
112112
pub mod lint;
113113

114114
pub mod middle {
115-
pub mod allocator;
116115
pub mod borrowck;
117116
pub mod expr_use_visitor;
118117
pub mod cstore;

src/librustc/middle/allocator.rs

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/librustc/session/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use rustc_data_structures::fingerprint::Fingerprint;
77

88
use crate::lint;
99
use crate::lint::builtin::BuiltinLintDiagnostics;
10-
use crate::middle::allocator::AllocatorKind;
1110
use crate::middle::dependency_format;
1211
use crate::session::config::{OutputType, PrintRequest, SwitchWithOptPath};
1312
use crate::session::search_paths::{PathKind, SearchPath};
@@ -27,6 +26,7 @@ use errors::emitter::HumanReadableErrorType;
2726
use errors::annotate_snippet_emitter_writer::{AnnotateSnippetEmitterWriter};
2827
use syntax::ast::{self, NodeId};
2928
use syntax::edition::Edition;
29+
use syntax::ext::allocator::AllocatorKind;
3030
use syntax::feature_gate::{self, AttributeType};
3131
use syntax::json::JsonEmitter;
3232
use syntax::source_map;

src/librustc_allocator/Cargo.toml

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/librustc_codegen_llvm/allocator.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ use std::ffi::CString;
22

33
use crate::attributes;
44
use libc::c_uint;
5-
use rustc::middle::allocator::AllocatorKind;
65
use rustc::ty::TyCtxt;
7-
use rustc_allocator::{ALLOCATOR_METHODS, AllocatorTy};
6+
use syntax::ext::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS};
87

98
use crate::ModuleLlvm;
109
use crate::llvm::{self, False, True};

src/librustc_codegen_llvm/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ extern crate flate2;
3232
#[macro_use] extern crate bitflags;
3333
extern crate libc;
3434
#[macro_use] extern crate rustc;
35-
extern crate rustc_allocator;
3635
extern crate rustc_target;
3736
#[macro_use] extern crate rustc_data_structures;
3837
extern crate rustc_incremental;
@@ -52,13 +51,13 @@ use rustc_codegen_ssa::back::lto::{SerializedModule, LtoModuleCodegen, ThinModul
5251
use rustc_codegen_ssa::CompiledModule;
5352
use errors::{FatalError, Handler};
5453
use rustc::dep_graph::WorkProduct;
54+
use syntax::ext::allocator::AllocatorKind;
5555
use syntax_pos::symbol::InternedString;
5656
pub use llvm_util::target_features;
5757
use std::any::Any;
5858
use std::sync::{mpsc, Arc};
5959

6060
use rustc::dep_graph::DepGraph;
61-
use rustc::middle::allocator::AllocatorKind;
6261
use rustc::middle::cstore::{EncodedMetadata, MetadataLoader};
6362
use rustc::session::Session;
6463
use rustc::session::config::{OutputFilenames, OutputType, PrintRequest, OptLevel};

src/librustc_codegen_ssa/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ serialize = { path = "../libserialize" }
2424
syntax = { path = "../libsyntax" }
2525
syntax_pos = { path = "../libsyntax_pos" }
2626
rustc = { path = "../librustc" }
27-
rustc_allocator = { path = "../librustc_allocator" }
2827
rustc_apfloat = { path = "../librustc_apfloat" }
2928
rustc_codegen_utils = { path = "../librustc_codegen_utils" }
3029
rustc_data_structures = { path = "../librustc_data_structures"}

src/librustc_codegen_ssa/back/symbol_export.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use std::collections::hash_map::Entry::*;
12
use std::sync::Arc;
23

34
use rustc::ty::Instance;
@@ -12,9 +13,8 @@ use rustc::ty::{TyCtxt, SymbolName};
1213
use rustc::ty::query::Providers;
1314
use rustc::ty::subst::SubstsRef;
1415
use rustc::util::nodemap::{FxHashMap, DefIdMap};
15-
use rustc_allocator::ALLOCATOR_METHODS;
1616
use rustc_data_structures::indexed_vec::IndexVec;
17-
use std::collections::hash_map::Entry::*;
17+
use syntax::ext::allocator::ALLOCATOR_METHODS;
1818

1919
pub type ExportedSymbols = FxHashMap<
2020
CrateNum,

0 commit comments

Comments
 (0)