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.
This commit is contained in:
commit
0b99489a89
32 changed files with 265 additions and 290 deletions
|
|
@ -6,6 +6,7 @@ use rustc_hir::def_id::CrateNum;
|
|||
use rustc_session::config::{
|
||||
self, CFGuard, DebugInfo, OutputFilenames, OutputType, PrintRequest, Sanitizer,
|
||||
};
|
||||
use rustc_session::output::{check_file_is_writeable, invalid_output_for_target, out_filename};
|
||||
use rustc_session::search_paths::PathKind;
|
||||
/// For all the linkers we support, and information they might
|
||||
/// need out of the shared crate context before we get rid of it.
|
||||
|
|
@ -36,8 +37,6 @@ use std::path::{Path, PathBuf};
|
|||
use std::process::{ExitStatus, Output, Stdio};
|
||||
use std::str;
|
||||
|
||||
pub use rustc_codegen_utils::link::*;
|
||||
|
||||
pub fn remove(sess: &Session, path: &Path) {
|
||||
if let Err(e) = fs::remove_file(path) {
|
||||
sess.err(&format!("failed to remove {}: {}", path.display(), e));
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ use rustc::ty::subst::{GenericArgKind, SubstsRef};
|
|||
use rustc::ty::Instance;
|
||||
use rustc::ty::{SymbolName, TyCtxt};
|
||||
use rustc_ast::expand::allocator::ALLOCATOR_METHODS;
|
||||
use rustc_codegen_utils::symbol_names;
|
||||
use rustc_data_structures::fingerprint::Fingerprint;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_hir as hir;
|
||||
|
|
@ -423,17 +422,21 @@ pub fn symbol_name_for_instance_in_crate<'tcx>(
|
|||
// This is something instantiated in an upstream crate, so we have to use
|
||||
// the slower (because uncached) version of computing the symbol name.
|
||||
match symbol {
|
||||
ExportedSymbol::NonGeneric(def_id) => symbol_names::symbol_name_for_instance_in_crate(
|
||||
tcx,
|
||||
Instance::mono(tcx, def_id),
|
||||
instantiating_crate,
|
||||
),
|
||||
ExportedSymbol::Generic(def_id, substs) => symbol_names::symbol_name_for_instance_in_crate(
|
||||
tcx,
|
||||
Instance::new(def_id, substs),
|
||||
instantiating_crate,
|
||||
),
|
||||
ExportedSymbol::DropGlue(ty) => symbol_names::symbol_name_for_instance_in_crate(
|
||||
ExportedSymbol::NonGeneric(def_id) => {
|
||||
rustc_symbol_mangling::symbol_name_for_instance_in_crate(
|
||||
tcx,
|
||||
Instance::mono(tcx, def_id),
|
||||
instantiating_crate,
|
||||
)
|
||||
}
|
||||
ExportedSymbol::Generic(def_id, substs) => {
|
||||
rustc_symbol_mangling::symbol_name_for_instance_in_crate(
|
||||
tcx,
|
||||
Instance::new(def_id, substs),
|
||||
instantiating_crate,
|
||||
)
|
||||
}
|
||||
ExportedSymbol::DropGlue(ty) => rustc_symbol_mangling::symbol_name_for_instance_in_crate(
|
||||
tcx,
|
||||
Instance::resolve_drop_in_place(tcx, ty),
|
||||
instantiating_crate,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue