mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-11 08:05:12 +00:00
Rollup merge of #42266 - rkruppe:clean-trans-api, r=arielb1
Remove unused APIs from rustc_trans There were public re-exports of some rustc modules dating back to 2011 or so. While I was at it, some functions and modules were public but never used outside the crate. I made them private or `pub(crate)` as appropriate and in one case removed an unused function.
This commit is contained in:
commit
1128fabb33
@ -40,7 +40,7 @@ const CFG: &'static str = "cfg";
|
||||
#[derive(Debug, PartialEq)]
|
||||
enum Disposition { Reused, Translated }
|
||||
|
||||
pub fn assert_module_sources<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
pub(crate) fn assert_module_sources<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
modules: &[ModuleTranslation]) {
|
||||
let _ignore = tcx.dep_graph.in_ignore();
|
||||
|
||||
|
@ -14,18 +14,16 @@ use super::rpath::RPathConfig;
|
||||
use super::rpath;
|
||||
use super::msvc;
|
||||
use metadata::METADATA_FILENAME;
|
||||
use session::config;
|
||||
use session::config::NoDebugInfo;
|
||||
use session::config::{OutputFilenames, Input, OutputType};
|
||||
use session::filesearch;
|
||||
use session::search_paths::PathKind;
|
||||
use session::Session;
|
||||
use middle::cstore::{self, LinkMeta, NativeLibrary, LibSource};
|
||||
use middle::cstore::{LinkagePreference, NativeLibraryKind};
|
||||
use middle::dependency_format::Linkage;
|
||||
use rustc::session::config::{self, NoDebugInfo, OutputFilenames, Input, OutputType};
|
||||
use rustc::session::filesearch;
|
||||
use rustc::session::search_paths::PathKind;
|
||||
use rustc::session::Session;
|
||||
use rustc::middle::cstore::{self, LinkMeta, NativeLibrary, LibSource, LinkagePreference,
|
||||
NativeLibraryKind};
|
||||
use rustc::middle::dependency_format::Linkage;
|
||||
use CrateTranslation;
|
||||
use util::common::time;
|
||||
use util::fs::fix_windows_verbatim_for_gcc;
|
||||
use rustc::util::common::time;
|
||||
use rustc::util::fs::fix_windows_verbatim_for_gcc;
|
||||
use rustc::dep_graph::DepNode;
|
||||
use rustc::hir::def_id::CrateNum;
|
||||
use rustc::hir::svh::Svh;
|
||||
|
@ -20,11 +20,11 @@ use context::SharedCrateContext;
|
||||
|
||||
use back::archive;
|
||||
use back::symbol_export::{self, ExportedSymbols};
|
||||
use middle::dependency_format::Linkage;
|
||||
use rustc::middle::dependency_format::Linkage;
|
||||
use rustc::hir::def_id::{LOCAL_CRATE, CrateNum};
|
||||
use rustc_back::LinkerFlavor;
|
||||
use session::Session;
|
||||
use session::config::{self, CrateType, OptLevel, DebugInfoLevel};
|
||||
use rustc::session::Session;
|
||||
use rustc::session::config::{self, CrateType, OptLevel, DebugInfoLevel};
|
||||
use serialize::{json, Encoder};
|
||||
|
||||
/// For all the linkers we support, and information they might
|
||||
|
@ -52,7 +52,7 @@ mod platform {
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
use session::Session;
|
||||
use rustc::session::Session;
|
||||
use super::arch::{host_arch, Arch};
|
||||
use super::registry::LOCAL_MACHINE;
|
||||
|
||||
@ -296,7 +296,7 @@ mod platform {
|
||||
mod platform {
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
use session::Session;
|
||||
use rustc::session::Session;
|
||||
pub fn link_exe_cmd(_sess: &Session) -> (Command, Option<PathBuf>) {
|
||||
(Command::new("link.exe"), None)
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
use context::SharedCrateContext;
|
||||
use monomorphize::Instance;
|
||||
use util::nodemap::FxHashMap;
|
||||
use rustc::util::nodemap::FxHashMap;
|
||||
use rustc::hir::def_id::{DefId, CrateNum, LOCAL_CRATE};
|
||||
use rustc::session::config;
|
||||
use rustc::ty::TyCtxt;
|
||||
|
@ -348,16 +348,6 @@ impl ItemPathBuffer for SymbolPathBuffer {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn exported_name_from_type_and_prefix<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
t: Ty<'tcx>,
|
||||
prefix: &str)
|
||||
-> String {
|
||||
let hash = get_symbol_hash(tcx, None, t, None);
|
||||
let mut buffer = SymbolPathBuffer::new();
|
||||
buffer.push(prefix);
|
||||
buffer.finish(hash)
|
||||
}
|
||||
|
||||
// Name sanitation. LLVM will happily accept identifiers with weird names, but
|
||||
// gas doesn't!
|
||||
// gas accepts the following characters in symbols: a-z, A-Z, 0-9, ., _, $
|
||||
|
@ -12,16 +12,15 @@ use back::lto;
|
||||
use back::link::{get_linker, remove};
|
||||
use back::symbol_export::ExportedSymbols;
|
||||
use rustc_incremental::{save_trans_partition, in_incr_comp_dir};
|
||||
use session::config::{OutputFilenames, OutputTypes, Passes, SomePasses, AllPasses, Sanitizer};
|
||||
use session::Session;
|
||||
use session::config::{self, OutputType};
|
||||
use rustc::session::config::{self, OutputFilenames, OutputType, OutputTypes, Passes, SomePasses,
|
||||
AllPasses, Sanitizer};
|
||||
use rustc::session::Session;
|
||||
use llvm;
|
||||
use llvm::{ModuleRef, TargetMachineRef, PassManagerRef, DiagnosticInfoRef, ContextRef};
|
||||
use llvm::SMDiagnosticRef;
|
||||
use {CrateTranslation, ModuleLlvm, ModuleSource, ModuleTranslation};
|
||||
use util::common::{time, time_depth, set_time_depth};
|
||||
use util::common::path2cstr;
|
||||
use util::fs::link_or_copy;
|
||||
use rustc::util::common::{time, time_depth, set_time_depth, path2cstr};
|
||||
use rustc::util::fs::link_or_copy;
|
||||
use errors::{self, Handler, Level, DiagnosticBuilder};
|
||||
use errors::emitter::Emitter;
|
||||
use syntax_pos::MultiSpan;
|
||||
|
@ -36,16 +36,16 @@ use llvm::{ContextRef, Linkage, ModuleRef, ValueRef, Vector, get_param};
|
||||
use llvm;
|
||||
use metadata;
|
||||
use rustc::hir::def_id::LOCAL_CRATE;
|
||||
use middle::lang_items::StartFnLangItem;
|
||||
use middle::cstore::EncodedMetadata;
|
||||
use rustc::middle::lang_items::StartFnLangItem;
|
||||
use rustc::middle::cstore::EncodedMetadata;
|
||||
use rustc::ty::{self, Ty, TyCtxt};
|
||||
use rustc::dep_graph::AssertDepGraphSafe;
|
||||
use rustc::middle::cstore::LinkMeta;
|
||||
use rustc::hir::map as hir_map;
|
||||
use rustc::util::common::time;
|
||||
use session::config::{self, NoDebugInfo};
|
||||
use rustc::session::config::{self, NoDebugInfo};
|
||||
use rustc::session::{self, DataTypeKind, Session};
|
||||
use rustc_incremental::IncrementalHashesMap;
|
||||
use session::{self, DataTypeKind, Session};
|
||||
use abi;
|
||||
use mir::lvalue::LvalueRef;
|
||||
use attributes;
|
||||
@ -71,7 +71,7 @@ use trans_item::{TransItem, DefPathBasedNames};
|
||||
use type_::Type;
|
||||
use type_of;
|
||||
use value::Value;
|
||||
use util::nodemap::{NodeSet, FxHashMap, FxHashSet};
|
||||
use rustc::util::nodemap::{NodeSet, FxHashMap, FxHashSet};
|
||||
|
||||
use libc::c_uint;
|
||||
use std::ffi::{CStr, CString};
|
||||
|
@ -204,7 +204,7 @@ use rustc::mir::visit::Visitor as MirVisitor;
|
||||
use context::SharedCrateContext;
|
||||
use common::{def_ty, instance_ty};
|
||||
use monomorphize::{self, Instance};
|
||||
use util::nodemap::{FxHashSet, FxHashMap, DefIdMap};
|
||||
use rustc::util::nodemap::{FxHashSet, FxHashMap, DefIdMap};
|
||||
|
||||
use trans_item::{TransItem, DefPathBasedNames, InstantiationMode};
|
||||
|
||||
|
@ -17,7 +17,7 @@ use llvm::{ValueRef, ContextRef, TypeKind};
|
||||
use llvm::{True, False, Bool, OperandBundleDef};
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::hir::map::DefPathData;
|
||||
use middle::lang_items::LangItem;
|
||||
use rustc::middle::lang_items::LangItem;
|
||||
use base;
|
||||
use builder::Builder;
|
||||
use consts;
|
||||
|
@ -26,10 +26,9 @@ use rustc_data_structures::base_n;
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::{self, Ty, TyCtxt};
|
||||
use rustc::ty::layout::{LayoutTyper, TyLayout};
|
||||
use session::config::NoDebugInfo;
|
||||
use session::Session;
|
||||
use session::config;
|
||||
use util::nodemap::{NodeSet, DefIdMap, FxHashMap};
|
||||
use rustc::session::config::{self, NoDebugInfo};
|
||||
use rustc::session::Session;
|
||||
use rustc::util::nodemap::{NodeSet, DefIdMap, FxHashMap};
|
||||
|
||||
use std::ffi::{CStr, CString};
|
||||
use std::cell::{Cell, RefCell};
|
||||
|
@ -16,7 +16,7 @@ use common::{C_bytes, CrateContext, C_i32};
|
||||
use builder::Builder;
|
||||
use declare;
|
||||
use type_::Type;
|
||||
use session::config::NoDebugInfo;
|
||||
use rustc::session::config::NoDebugInfo;
|
||||
|
||||
use std::ptr;
|
||||
use syntax::attr;
|
||||
|
@ -19,7 +19,6 @@ use super::namespace::mangled_name_of_item;
|
||||
use super::type_names::compute_debuginfo_type_name;
|
||||
use super::{CrateDebugContext};
|
||||
use context::SharedCrateContext;
|
||||
use session::Session;
|
||||
|
||||
use llvm::{self, ValueRef};
|
||||
use llvm::debuginfo::{DIType, DIFile, DIScope, DIDescriptor,
|
||||
@ -37,8 +36,8 @@ use common::{self, CrateContext};
|
||||
use type_::Type;
|
||||
use rustc::ty::{self, AdtKind, Ty};
|
||||
use rustc::ty::layout::{self, LayoutTyper};
|
||||
use session::config;
|
||||
use util::nodemap::FxHashMap;
|
||||
use rustc::session::{Session, config};
|
||||
use rustc::util::nodemap::FxHashMap;
|
||||
|
||||
use libc::{c_uint, c_longlong};
|
||||
use std::ffi::CString;
|
||||
|
@ -32,8 +32,8 @@ use builder::Builder;
|
||||
use monomorphize::Instance;
|
||||
use rustc::ty::{self, Ty};
|
||||
use rustc::mir;
|
||||
use session::config::{self, FullDebugInfo, LimitedDebugInfo, NoDebugInfo};
|
||||
use util::nodemap::{DefIdMap, FxHashMap, FxHashSet};
|
||||
use rustc::session::config::{self, FullDebugInfo, LimitedDebugInfo, NoDebugInfo};
|
||||
use rustc::util::nodemap::{DefIdMap, FxHashMap, FxHashSet};
|
||||
|
||||
use libc::c_uint;
|
||||
use std::cell::{Cell, RefCell};
|
||||
|
@ -63,11 +63,6 @@ extern crate syntax_pos;
|
||||
extern crate rustc_errors as errors;
|
||||
extern crate serialize;
|
||||
|
||||
pub use rustc::session;
|
||||
pub use rustc::middle;
|
||||
pub use rustc::lint;
|
||||
pub use rustc::util;
|
||||
|
||||
pub use base::trans_crate;
|
||||
pub use back::symbol_names::provide;
|
||||
|
||||
@ -75,20 +70,18 @@ pub use metadata::LlvmMetadataLoader;
|
||||
pub use llvm_util::{init, target_features, print_version, print_passes, print, enable_llvm_debug};
|
||||
|
||||
pub mod back {
|
||||
pub use rustc::hir::svh;
|
||||
|
||||
pub mod archive;
|
||||
pub mod linker;
|
||||
mod archive;
|
||||
pub(crate) mod linker;
|
||||
pub mod link;
|
||||
pub mod lto;
|
||||
pub mod symbol_export;
|
||||
pub mod symbol_names;
|
||||
mod lto;
|
||||
pub(crate) mod symbol_export;
|
||||
pub(crate) mod symbol_names;
|
||||
pub mod write;
|
||||
pub mod msvc;
|
||||
pub mod rpath;
|
||||
mod msvc;
|
||||
mod rpath;
|
||||
}
|
||||
|
||||
pub mod diagnostics;
|
||||
mod diagnostics;
|
||||
|
||||
mod abi;
|
||||
mod adt;
|
||||
@ -171,8 +164,8 @@ pub struct CrateTranslation {
|
||||
pub crate_name: Symbol,
|
||||
pub modules: Vec<ModuleTranslation>,
|
||||
pub metadata_module: ModuleTranslation,
|
||||
pub link: middle::cstore::LinkMeta,
|
||||
pub metadata: middle::cstore::EncodedMetadata,
|
||||
pub link: rustc::middle::cstore::LinkMeta,
|
||||
pub metadata: rustc::middle::cstore::EncodedMetadata,
|
||||
pub exported_symbols: back::symbol_export::ExportedSymbols,
|
||||
pub no_builtins: bool,
|
||||
pub windows_subsystem: Option<String>,
|
||||
|
@ -17,7 +17,7 @@ use rustc::mir::{self, Mir};
|
||||
use rustc::mir::tcx::LvalueTy;
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::infer::TransNormalize;
|
||||
use session::config::FullDebugInfo;
|
||||
use rustc::session::config::FullDebugInfo;
|
||||
use base;
|
||||
use builder::Builder;
|
||||
use common::{self, CrateContext, Funclet};
|
||||
|
@ -14,7 +14,7 @@ use rustc::ty::cast::{CastTy, IntTy};
|
||||
use rustc::ty::layout::{Layout, LayoutTyper};
|
||||
use rustc::mir::tcx::LvalueTy;
|
||||
use rustc::mir;
|
||||
use middle::lang_items::ExchangeMallocFnLangItem;
|
||||
use rustc::middle::lang_items::ExchangeMallocFnLangItem;
|
||||
|
||||
use base;
|
||||
use builder::Builder;
|
||||
|
@ -118,7 +118,7 @@ use std::sync::Arc;
|
||||
use syntax::ast::NodeId;
|
||||
use syntax::symbol::{Symbol, InternedString};
|
||||
use trans_item::{TransItem, InstantiationMode};
|
||||
use util::nodemap::{FxHashMap, FxHashSet};
|
||||
use rustc::util::nodemap::{FxHashMap, FxHashSet};
|
||||
|
||||
pub enum PartitioningStrategy {
|
||||
/// Generate one codegen unit per source-level module.
|
||||
|
Loading…
Reference in New Issue
Block a user