about summary refs log tree commit diff
path: root/src/librustc_driver
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2020-03-21 08:51:14 +0100
committerGitHub <noreply@github.com>2020-03-21 08:51:14 +0100
commit0b99489a89a10b5bd4e69ca9d9c32d03582c4aea (patch)
tree50de525c3b0fcd9749e2216621f6eddd0bb143bb /src/librustc_driver
parent426a4cc930476a557b1e8b3d708a8bec97bad92a (diff)
parent2d75a339ca9e7cd11338b165311927e6eb73cca4 (diff)
Rollup merge of #69965 - mark-i-m:codegen-utils, r=eddyb
Refactorings to get rid of rustc_codegen_utils

r? @eddyb

cc #45276

After this, the only modules left in `rustc_codegen_utils` are
- `link`: a bunch of linking-related functions (many dealing with file names). These are mostly consumed by save analysis, rustc_driver, rustc_interface, and of course codegen. I assume they live here because we don't want a dependency of save analysis on codegen... Perhaps they can be moved to librustc?
- ~`symbol_names` and `symbol_names_test`: honestly it seems odd that `symbol_names_test` is not a submodule of `symbol_names`. It seems like these could honestly live in their own crate or move to librustc. Already name mangling is exported as the `symbol_name` query.~ (move it to its own crate)

I don't mind doing either of the above as part of this PR or a followup if you want.
Diffstat (limited to 'src/librustc_driver')
-rw-r--r--src/librustc_driver/Cargo.toml3
-rw-r--r--src/librustc_driver/lib.rs18
2 files changed, 8 insertions, 13 deletions
diff --git a/src/librustc_driver/Cargo.toml b/src/librustc_driver/Cargo.toml
index 3e644958231..aec10ee5ef5 100644
--- a/src/librustc_driver/Cargo.toml
+++ b/src/librustc_driver/Cargo.toml
@@ -27,13 +27,12 @@ rustc_parse = { path = "../librustc_parse" }
 rustc_plugin_impl = { path = "../librustc_plugin_impl" }
 rustc_save_analysis = { path = "../librustc_save_analysis" }
 rustc_codegen_ssa = { path = "../librustc_codegen_ssa" }
-rustc_codegen_utils = { path = "../librustc_codegen_utils" }
+rustc_session = { path = "../librustc_session" }
 rustc_error_codes = { path = "../librustc_error_codes" }
 rustc_interface = { path = "../librustc_interface" }
 rustc_serialize = { path = "../libserialize", package = "serialize" }
 rustc_ast = { path = "../librustc_ast" }
 rustc_span = { path = "../librustc_span" }
-rustc_session = { path = "../librustc_session" }
 
 [target.'cfg(windows)'.dependencies]
 winapi = { version = "0.3", features = ["consoleapi", "debugapi", "processenv"] }
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index e3e076e769f..9097a72f36f 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -21,8 +21,8 @@ pub extern crate rustc_plugin_impl as plugin;
 use rustc::middle::cstore::MetadataLoader;
 use rustc::ty::TyCtxt;
 use rustc::util::common::ErrorReported;
-use rustc_codegen_ssa::CodegenResults;
-use rustc_codegen_utils::codegen_backend::CodegenBackend;
+use rustc_ast::ast;
+use rustc_codegen_ssa::{traits::CodegenBackend, CodegenResults};
 use rustc_data_structures::profiling::print_time_passes_entry;
 use rustc_data_structures::sync::SeqCst;
 use rustc_errors::{
@@ -43,6 +43,8 @@ use rustc_session::config::{ErrorOutputType, Input, OutputType, PrintRequest};
 use rustc_session::lint::{Lint, LintId};
 use rustc_session::{config, DiagnosticOutput, Session};
 use rustc_session::{early_error, early_warn};
+use rustc_span::source_map::{FileLoader, FileName};
+use rustc_span::symbol::sym;
 
 use std::borrow::Cow;
 use std::cmp::max;
@@ -58,11 +60,6 @@ use std::process::{self, Command, Stdio};
 use std::str;
 use std::time::Instant;
 
-use rustc_ast::ast;
-use rustc_span::source_map::FileLoader;
-use rustc_span::symbol::sym;
-use rustc_span::FileName;
-
 mod args;
 pub mod pretty;
 
@@ -693,16 +690,15 @@ impl RustcDefaultCalls {
                     let t_outputs = rustc_interface::util::build_output_filenames(
                         input, odir, ofile, attrs, sess,
                     );
-                    let id = rustc_codegen_utils::link::find_crate_name(Some(sess), attrs, input);
+                    let id = rustc_session::output::find_crate_name(Some(sess), attrs, input);
                     if *req == PrintRequest::CrateName {
                         println!("{}", id);
                         continue;
                     }
                     let crate_types = collect_crate_types(sess, attrs);
                     for &style in &crate_types {
-                        let fname = rustc_codegen_utils::link::filename_for_input(
-                            sess, style, &id, &t_outputs,
-                        );
+                        let fname =
+                            rustc_session::output::filename_for_input(sess, style, &id, &t_outputs);
                         println!("{}", fname.file_name().unwrap().to_string_lossy());
                     }
                 }