Skip to content

Commit

Permalink
Auto merge of #107549 - Zoxc:rustc-shared, r=jyn514
Browse files Browse the repository at this point in the history
Move code in `rustc_driver` out to a new `rustc_driver_impl` crate to allow pipelining

That adds a `rustc_shared` library which contains all the rustc library crates in a single dylib. It takes over this role from `rustc_driver`. This is done so that `rustc_driver` can be compiled in parallel with other crates. `rustc_shared` is intentionally left empty so it only does linking.

An alternative could be to move the code currently in `rustc_driver` into a new crate to avoid changing the name of the distributed library.
  • Loading branch information
bors committed Feb 4, 2023
2 parents 9dee4e4 + 2b8f892 commit 3de7d7f
Show file tree
Hide file tree
Showing 11 changed files with 1,437 additions and 1,415 deletions.
8 changes: 8 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3567,6 +3567,7 @@ dependencies = [
"jemalloc-sys",
"rustc_codegen_ssa",
"rustc_driver",
"rustc_driver_impl",
"rustc_smir",
]

Expand Down Expand Up @@ -3946,6 +3947,13 @@ dependencies = [
[[package]]
name = "rustc_driver"
version = "0.0.0"
dependencies = [
"rustc_driver_impl",
]

[[package]]
name = "rustc_driver_impl"
version = "0.0.0"
dependencies = [
"libc",
"rustc_ast",
Expand Down
7 changes: 4 additions & 3 deletions compiler/rustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ edition = "2021"

[dependencies]
rustc_driver = { path = "../rustc_driver" }
rustc_driver_impl = { path = "../rustc_driver_impl" }

# Make sure rustc_codegen_ssa ends up in the sysroot, because this
# crate is intended to be used by codegen backends, which may not be in-tree.
Expand All @@ -20,6 +21,6 @@ features = ['unprefixed_malloc_on_supported_platforms']

[features]
jemalloc = ['jemalloc-sys']
llvm = ['rustc_driver/llvm']
max_level_info = ['rustc_driver/max_level_info']
rustc_use_parallel_compiler = ['rustc_driver/rustc_use_parallel_compiler']
llvm = ['rustc_driver_impl/llvm']
max_level_info = ['rustc_driver_impl/max_level_info']
rustc_use_parallel_compiler = ['rustc_driver_impl/rustc_use_parallel_compiler']
37 changes: 1 addition & 36 deletions compiler/rustc_driver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,4 @@ edition = "2021"
crate-type = ["dylib"]

[dependencies]
tracing = { version = "0.1.35" }
serde_json = "1.0.59"
rustc_log = { path = "../rustc_log" }
rustc_middle = { path = "../rustc_middle" }
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
rustc_target = { path = "../rustc_target" }
rustc_lint = { path = "../rustc_lint" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_feature = { path = "../rustc_feature" }
rustc_hir = { path = "../rustc_hir" }
rustc_hir_pretty = { path = "../rustc_hir_pretty" }
rustc_macros = { path = "../rustc_macros" }
rustc_metadata = { path = "../rustc_metadata" }
rustc_parse = { path = "../rustc_parse" }
rustc_plugin_impl = { path = "../rustc_plugin_impl" }
rustc_save_analysis = { path = "../rustc_save_analysis" }
rustc_codegen_ssa = { path = "../rustc_codegen_ssa" }
rustc_session = { path = "../rustc_session" }
rustc_error_codes = { path = "../rustc_error_codes" }
rustc_interface = { path = "../rustc_interface" }
rustc_ast = { path = "../rustc_ast" }
rustc_span = { path = "../rustc_span" }
rustc_hir_analysis = { path = "../rustc_hir_analysis" }

[target.'cfg(unix)'.dependencies]
libc = "0.2"

[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = ["consoleapi", "debugapi", "processenv"] }

[features]
llvm = ['rustc_interface/llvm']
max_level_info = ['rustc_log/max_level_info']
rustc_use_parallel_compiler = ['rustc_data_structures/rustc_use_parallel_compiler', 'rustc_interface/rustc_use_parallel_compiler',
'rustc_middle/rustc_use_parallel_compiler']
rustc_driver_impl = { path = "../rustc_driver_impl" }
Loading

0 comments on commit 3de7d7f

Please sign in to comment.