Skip to content

Commit 2aceaf4

Browse files
committed
Add a new rustc_driver dylib to rexport rustc_driver_impl
1 parent 7368132 commit 2aceaf4

File tree

7 files changed

+54
-29
lines changed

7 files changed

+54
-29
lines changed

Cargo.lock

+8
Original file line numberDiff line numberDiff line change
@@ -3567,6 +3567,7 @@ dependencies = [
35673567
"jemalloc-sys",
35683568
"rustc_codegen_ssa",
35693569
"rustc_driver",
3570+
"rustc_driver_impl",
35703571
"rustc_smir",
35713572
]
35723573

@@ -3946,6 +3947,13 @@ dependencies = [
39463947
[[package]]
39473948
name = "rustc_driver"
39483949
version = "0.0.0"
3950+
dependencies = [
3951+
"rustc_driver_impl",
3952+
]
3953+
3954+
[[package]]
3955+
name = "rustc_driver_impl"
3956+
version = "0.0.0"
39493957
dependencies = [
39503958
"libc",
39513959
"rustc_ast",

compiler/rustc/Cargo.toml

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ edition = "2021"
55

66
[dependencies]
77
rustc_driver = { path = "../rustc_driver" }
8+
rustc_driver_impl = { path = "../rustc_driver_impl" }
89

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

2122
[features]
2223
jemalloc = ['jemalloc-sys']
23-
llvm = ['rustc_driver/llvm']
24-
max_level_info = ['rustc_driver/max_level_info']
25-
rustc_use_parallel_compiler = ['rustc_driver/rustc_use_parallel_compiler']
24+
llvm = ['rustc_driver_impl/llvm']
25+
max_level_info = ['rustc_driver_impl/max_level_info']
26+
rustc_use_parallel_compiler = ['rustc_driver_impl/rustc_use_parallel_compiler']

compiler/rustc_driver/Cargo.toml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[package]
2+
name = "rustc_driver"
3+
version = "0.0.0"
4+
edition = "2021"
5+
6+
[lib]
7+
crate-type = ["dylib"]
8+
9+
[dependencies]
10+
rustc_driver_impl = { path = "../rustc_driver_impl" }

compiler/rustc_driver/src/lib.rs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// This crate is intentionally empty and a rexport of `rustc_driver_impl` to allow the code in
2+
// `rustc_driver_impl` to be compiled in parallel with other crates.
3+
4+
#![allow(unused_extern_crates)]
5+
extern crate rustc_driver_impl;
6+
7+
pub use rustc_driver_impl::*;

compiler/rustc_driver_impl/Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
[package]
2-
name = "rustc_driver"
2+
name = "rustc_driver_impl"
33
version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
crate-type = ["dylib"]
87

98
[dependencies]
109
tracing = { version = "0.1.35" }
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,67 @@
11
use rustc_macros::Diagnostic;
22

33
#[derive(Diagnostic)]
4-
#[diag(driver_rlink_unable_to_read)]
4+
#[diag(driver_impl_rlink_unable_to_read)]
55
pub(crate) struct RlinkUnableToRead {
66
pub err: std::io::Error,
77
}
88

99
#[derive(Diagnostic)]
10-
#[diag(driver_rlink_wrong_file_type)]
10+
#[diag(driver_impl_rlink_wrong_file_type)]
1111
pub(crate) struct RLinkWrongFileType;
1212

1313
#[derive(Diagnostic)]
14-
#[diag(driver_rlink_empty_version_number)]
14+
#[diag(driver_impl_rlink_empty_version_number)]
1515
pub(crate) struct RLinkEmptyVersionNumber;
1616

1717
#[derive(Diagnostic)]
18-
#[diag(driver_rlink_encoding_version_mismatch)]
18+
#[diag(driver_impl_rlink_encoding_version_mismatch)]
1919
pub(crate) struct RLinkEncodingVersionMismatch {
2020
pub version_array: String,
2121
pub rlink_version: u32,
2222
}
2323

2424
#[derive(Diagnostic)]
25-
#[diag(driver_rlink_rustc_version_mismatch)]
25+
#[diag(driver_impl_rlink_rustc_version_mismatch)]
2626
pub(crate) struct RLinkRustcVersionMismatch<'a> {
2727
pub rustc_version: String,
2828
pub current_version: &'a str,
2929
}
3030

3131
#[derive(Diagnostic)]
32-
#[diag(driver_rlink_no_a_file)]
32+
#[diag(driver_impl_rlink_no_a_file)]
3333
pub(crate) struct RlinkNotAFile;
3434

3535
#[derive(Diagnostic)]
36-
#[diag(driver_unpretty_dump_fail)]
36+
#[diag(driver_impl_unpretty_dump_fail)]
3737
pub(crate) struct UnprettyDumpFail {
3838
pub path: String,
3939
pub err: String,
4040
}
4141

4242
#[derive(Diagnostic)]
43-
#[diag(driver_ice)]
43+
#[diag(driver_impl_ice)]
4444
pub(crate) struct Ice;
4545

4646
#[derive(Diagnostic)]
47-
#[diag(driver_ice_bug_report)]
47+
#[diag(driver_impl_ice_bug_report)]
4848
pub(crate) struct IceBugReport<'a> {
4949
pub bug_report_url: &'a str,
5050
}
5151

5252
#[derive(Diagnostic)]
53-
#[diag(driver_ice_version)]
53+
#[diag(driver_impl_ice_version)]
5454
pub(crate) struct IceVersion<'a> {
5555
pub version: &'a str,
5656
pub triple: &'a str,
5757
}
5858

5959
#[derive(Diagnostic)]
60-
#[diag(driver_ice_flags)]
60+
#[diag(driver_impl_ice_flags)]
6161
pub(crate) struct IceFlags {
6262
pub flags: String,
6363
}
6464

6565
#[derive(Diagnostic)]
66-
#[diag(driver_ice_exclude_cargo_defaults)]
66+
#[diag(driver_impl_ice_exclude_cargo_defaults)]
6767
pub(crate) struct IceExcludeCargoDefaults;
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
driver_rlink_unable_to_read = failed to read rlink file: `{$err}`
1+
driver_impl_rlink_unable_to_read = failed to read rlink file: `{$err}`
22
3-
driver_rlink_wrong_file_type = The input does not look like a .rlink file
3+
driver_impl_rlink_wrong_file_type = The input does not look like a .rlink file
44
5-
driver_rlink_empty_version_number = The input does not contain version number
5+
driver_impl_rlink_empty_version_number = The input does not contain version number
66
7-
driver_rlink_encoding_version_mismatch = .rlink file was produced with encoding version `{$version_array}`, but the current version is `{$rlink_version}`
7+
driver_impl_rlink_encoding_version_mismatch = .rlink file was produced with encoding version `{$version_array}`, but the current version is `{$rlink_version}`
88
9-
driver_rlink_rustc_version_mismatch = .rlink file was produced by rustc version `{$rustc_version}`, but the current version is `{$current_version}`
9+
driver_impl_rlink_rustc_version_mismatch = .rlink file was produced by rustc version `{$rustc_version}`, but the current version is `{$current_version}`
1010
11-
driver_rlink_no_a_file = rlink must be a file
11+
driver_impl_rlink_no_a_file = rlink must be a file
1212
13-
driver_unpretty_dump_fail = pretty-print failed to write `{$path}` due to error `{$err}`
13+
driver_impl_unpretty_dump_fail = pretty-print failed to write `{$path}` due to error `{$err}`
1414
15-
driver_ice = the compiler unexpectedly panicked. this is a bug.
16-
driver_ice_bug_report = we would appreciate a bug report: {$bug_report_url}
17-
driver_ice_version = rustc {$version} running on {$triple}
18-
driver_ice_flags = compiler flags: {$flags}
19-
driver_ice_exclude_cargo_defaults = some of the compiler flags provided by cargo are hidden
15+
driver_impl_ice = the compiler unexpectedly panicked. this is a bug.
16+
driver_impl_ice_bug_report = we would appreciate a bug report: {$bug_report_url}
17+
driver_impl_ice_version = rustc {$version} running on {$triple}
18+
driver_impl_ice_flags = compiler flags: {$flags}
19+
driver_impl_ice_exclude_cargo_defaults = some of the compiler flags provided by cargo are hidden

0 commit comments

Comments
 (0)