about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2023-02-02 07:17:46 +0100
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2023-02-02 07:34:41 +0100
commit2aceaf4849a806813c31e9987df458e08c11e5f3 (patch)
treeb47c1afcbb519e4ae64919507c9b0bcfd961e577
parent73681323e611972caa9a6107312c9e1f74467545 (diff)
downloadrust-2aceaf4849a806813c31e9987df458e08c11e5f3.tar.gz
rust-2aceaf4849a806813c31e9987df458e08c11e5f3.zip
Add a new `rustc_driver` dylib to rexport `rustc_driver_impl`
-rw-r--r--Cargo.lock8
-rw-r--r--compiler/rustc/Cargo.toml7
-rw-r--r--compiler/rustc_driver/Cargo.toml10
-rw-r--r--compiler/rustc_driver/src/lib.rs7
-rw-r--r--compiler/rustc_driver_impl/Cargo.toml3
-rw-r--r--compiler/rustc_driver_impl/src/session_diagnostics.rs24
-rw-r--r--compiler/rustc_error_messages/locales/en-US/driver.ftl24
7 files changed, 54 insertions, 29 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 14758d0f07e..705210e44b2 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3567,6 +3567,7 @@ dependencies = [
  "jemalloc-sys",
  "rustc_codegen_ssa",
  "rustc_driver",
+ "rustc_driver_impl",
  "rustc_smir",
 ]
 
@@ -3947,6 +3948,13 @@ dependencies = [
 name = "rustc_driver"
 version = "0.0.0"
 dependencies = [
+ "rustc_driver_impl",
+]
+
+[[package]]
+name = "rustc_driver_impl"
+version = "0.0.0"
+dependencies = [
  "libc",
  "rustc_ast",
  "rustc_ast_pretty",
diff --git a/compiler/rustc/Cargo.toml b/compiler/rustc/Cargo.toml
index 27ee3dd2aea..41003ad83f3 100644
--- a/compiler/rustc/Cargo.toml
+++ b/compiler/rustc/Cargo.toml
@@ -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.
@@ -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']
diff --git a/compiler/rustc_driver/Cargo.toml b/compiler/rustc_driver/Cargo.toml
new file mode 100644
index 00000000000..d7c295418ba
--- /dev/null
+++ b/compiler/rustc_driver/Cargo.toml
@@ -0,0 +1,10 @@
+[package]
+name = "rustc_driver"
+version = "0.0.0"
+edition = "2021"
+
+[lib]
+crate-type = ["dylib"]
+
+[dependencies]
+rustc_driver_impl = { path = "../rustc_driver_impl" }
diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs
new file mode 100644
index 00000000000..195fc71b649
--- /dev/null
+++ b/compiler/rustc_driver/src/lib.rs
@@ -0,0 +1,7 @@
+// This crate is intentionally empty and a rexport of `rustc_driver_impl` to allow the code in
+// `rustc_driver_impl` to be compiled in parallel with other crates.
+
+#![allow(unused_extern_crates)]
+extern crate rustc_driver_impl;
+
+pub use rustc_driver_impl::*;
diff --git a/compiler/rustc_driver_impl/Cargo.toml b/compiler/rustc_driver_impl/Cargo.toml
index 59e93777748..af85b12c52b 100644
--- a/compiler/rustc_driver_impl/Cargo.toml
+++ b/compiler/rustc_driver_impl/Cargo.toml
@@ -1,10 +1,9 @@
 [package]
-name = "rustc_driver"
+name = "rustc_driver_impl"
 version = "0.0.0"
 edition = "2021"
 
 [lib]
-crate-type = ["dylib"]
 
 [dependencies]
 tracing = { version = "0.1.35" }
diff --git a/compiler/rustc_driver_impl/src/session_diagnostics.rs b/compiler/rustc_driver_impl/src/session_diagnostics.rs
index a7aef9cbc2c..638b368f702 100644
--- a/compiler/rustc_driver_impl/src/session_diagnostics.rs
+++ b/compiler/rustc_driver_impl/src/session_diagnostics.rs
@@ -1,67 +1,67 @@
 use rustc_macros::Diagnostic;
 
 #[derive(Diagnostic)]
-#[diag(driver_rlink_unable_to_read)]
+#[diag(driver_impl_rlink_unable_to_read)]
 pub(crate) struct RlinkUnableToRead {
     pub err: std::io::Error,
 }
 
 #[derive(Diagnostic)]
-#[diag(driver_rlink_wrong_file_type)]
+#[diag(driver_impl_rlink_wrong_file_type)]
 pub(crate) struct RLinkWrongFileType;
 
 #[derive(Diagnostic)]
-#[diag(driver_rlink_empty_version_number)]
+#[diag(driver_impl_rlink_empty_version_number)]
 pub(crate) struct RLinkEmptyVersionNumber;
 
 #[derive(Diagnostic)]
-#[diag(driver_rlink_encoding_version_mismatch)]
+#[diag(driver_impl_rlink_encoding_version_mismatch)]
 pub(crate) struct RLinkEncodingVersionMismatch {
     pub version_array: String,
     pub rlink_version: u32,
 }
 
 #[derive(Diagnostic)]
-#[diag(driver_rlink_rustc_version_mismatch)]
+#[diag(driver_impl_rlink_rustc_version_mismatch)]
 pub(crate) struct RLinkRustcVersionMismatch<'a> {
     pub rustc_version: String,
     pub current_version: &'a str,
 }
 
 #[derive(Diagnostic)]
-#[diag(driver_rlink_no_a_file)]
+#[diag(driver_impl_rlink_no_a_file)]
 pub(crate) struct RlinkNotAFile;
 
 #[derive(Diagnostic)]
-#[diag(driver_unpretty_dump_fail)]
+#[diag(driver_impl_unpretty_dump_fail)]
 pub(crate) struct UnprettyDumpFail {
     pub path: String,
     pub err: String,
 }
 
 #[derive(Diagnostic)]
-#[diag(driver_ice)]
+#[diag(driver_impl_ice)]
 pub(crate) struct Ice;
 
 #[derive(Diagnostic)]
-#[diag(driver_ice_bug_report)]
+#[diag(driver_impl_ice_bug_report)]
 pub(crate) struct IceBugReport<'a> {
     pub bug_report_url: &'a str,
 }
 
 #[derive(Diagnostic)]
-#[diag(driver_ice_version)]
+#[diag(driver_impl_ice_version)]
 pub(crate) struct IceVersion<'a> {
     pub version: &'a str,
     pub triple: &'a str,
 }
 
 #[derive(Diagnostic)]
-#[diag(driver_ice_flags)]
+#[diag(driver_impl_ice_flags)]
 pub(crate) struct IceFlags {
     pub flags: String,
 }
 
 #[derive(Diagnostic)]
-#[diag(driver_ice_exclude_cargo_defaults)]
+#[diag(driver_impl_ice_exclude_cargo_defaults)]
 pub(crate) struct IceExcludeCargoDefaults;
diff --git a/compiler/rustc_error_messages/locales/en-US/driver.ftl b/compiler/rustc_error_messages/locales/en-US/driver.ftl
index 79ffc82c6c6..f19b1ff6426 100644
--- a/compiler/rustc_error_messages/locales/en-US/driver.ftl
+++ b/compiler/rustc_error_messages/locales/en-US/driver.ftl
@@ -1,19 +1,19 @@
-driver_rlink_unable_to_read = failed to read rlink file: `{$err}`
+driver_impl_rlink_unable_to_read = failed to read rlink file: `{$err}`
 
-driver_rlink_wrong_file_type = The input does not look like a .rlink file
+driver_impl_rlink_wrong_file_type = The input does not look like a .rlink file
 
-driver_rlink_empty_version_number = The input does not contain version number
+driver_impl_rlink_empty_version_number = The input does not contain version number
 
-driver_rlink_encoding_version_mismatch = .rlink file was produced with encoding version `{$version_array}`, but the current version is `{$rlink_version}`
+driver_impl_rlink_encoding_version_mismatch = .rlink file was produced with encoding version `{$version_array}`, but the current version is `{$rlink_version}`
 
-driver_rlink_rustc_version_mismatch = .rlink file was produced by rustc version `{$rustc_version}`, but the current version is `{$current_version}`
+driver_impl_rlink_rustc_version_mismatch = .rlink file was produced by rustc version `{$rustc_version}`, but the current version is `{$current_version}`
 
-driver_rlink_no_a_file = rlink must be a file
+driver_impl_rlink_no_a_file = rlink must be a file
 
-driver_unpretty_dump_fail = pretty-print failed to write `{$path}` due to error `{$err}`
+driver_impl_unpretty_dump_fail = pretty-print failed to write `{$path}` due to error `{$err}`
 
-driver_ice = the compiler unexpectedly panicked. this is a bug.
-driver_ice_bug_report = we would appreciate a bug report: {$bug_report_url}
-driver_ice_version = rustc {$version} running on {$triple}
-driver_ice_flags = compiler flags: {$flags}
-driver_ice_exclude_cargo_defaults = some of the compiler flags provided by cargo are hidden
+driver_impl_ice = the compiler unexpectedly panicked. this is a bug.
+driver_impl_ice_bug_report = we would appreciate a bug report: {$bug_report_url}
+driver_impl_ice_version = rustc {$version} running on {$triple}
+driver_impl_ice_flags = compiler flags: {$flags}
+driver_impl_ice_exclude_cargo_defaults = some of the compiler flags provided by cargo are hidden