Skip to content

Commit 1128fab

Browse files
Rollup merge of rust-lang#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.
2 parents 423b410 + 6fec17e commit 1128fab

File tree

18 files changed

+50
-72
lines changed

18 files changed

+50
-72
lines changed

src/librustc_trans/assert_module_sources.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ const CFG: &'static str = "cfg";
4040
#[derive(Debug, PartialEq)]
4141
enum Disposition { Reused, Translated }
4242

43-
pub fn assert_module_sources<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
44-
modules: &[ModuleTranslation]) {
43+
pub(crate) fn assert_module_sources<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
44+
modules: &[ModuleTranslation]) {
4545
let _ignore = tcx.dep_graph.in_ignore();
4646

4747
if tcx.sess.opts.incremental.is_none() {

src/librustc_trans/back/link.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,16 @@ use super::rpath::RPathConfig;
1414
use super::rpath;
1515
use super::msvc;
1616
use metadata::METADATA_FILENAME;
17-
use session::config;
18-
use session::config::NoDebugInfo;
19-
use session::config::{OutputFilenames, Input, OutputType};
20-
use session::filesearch;
21-
use session::search_paths::PathKind;
22-
use session::Session;
23-
use middle::cstore::{self, LinkMeta, NativeLibrary, LibSource};
24-
use middle::cstore::{LinkagePreference, NativeLibraryKind};
25-
use middle::dependency_format::Linkage;
17+
use rustc::session::config::{self, NoDebugInfo, OutputFilenames, Input, OutputType};
18+
use rustc::session::filesearch;
19+
use rustc::session::search_paths::PathKind;
20+
use rustc::session::Session;
21+
use rustc::middle::cstore::{self, LinkMeta, NativeLibrary, LibSource, LinkagePreference,
22+
NativeLibraryKind};
23+
use rustc::middle::dependency_format::Linkage;
2624
use CrateTranslation;
27-
use util::common::time;
28-
use util::fs::fix_windows_verbatim_for_gcc;
25+
use rustc::util::common::time;
26+
use rustc::util::fs::fix_windows_verbatim_for_gcc;
2927
use rustc::dep_graph::DepNode;
3028
use rustc::hir::def_id::CrateNum;
3129
use rustc::hir::svh::Svh;

src/librustc_trans/back/linker.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ use context::SharedCrateContext;
2020

2121
use back::archive;
2222
use back::symbol_export::{self, ExportedSymbols};
23-
use middle::dependency_format::Linkage;
23+
use rustc::middle::dependency_format::Linkage;
2424
use rustc::hir::def_id::{LOCAL_CRATE, CrateNum};
2525
use rustc_back::LinkerFlavor;
26-
use session::Session;
27-
use session::config::{self, CrateType, OptLevel, DebugInfoLevel};
26+
use rustc::session::Session;
27+
use rustc::session::config::{self, CrateType, OptLevel, DebugInfoLevel};
2828
use serialize::{json, Encoder};
2929

3030
/// For all the linkers we support, and information they might

src/librustc_trans/back/msvc/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ mod platform {
5252
use std::fs;
5353
use std::path::{Path, PathBuf};
5454
use std::process::Command;
55-
use session::Session;
55+
use rustc::session::Session;
5656
use super::arch::{host_arch, Arch};
5757
use super::registry::LOCAL_MACHINE;
5858

@@ -296,7 +296,7 @@ mod platform {
296296
mod platform {
297297
use std::path::PathBuf;
298298
use std::process::Command;
299-
use session::Session;
299+
use rustc::session::Session;
300300
pub fn link_exe_cmd(_sess: &Session) -> (Command, Option<PathBuf>) {
301301
(Command::new("link.exe"), None)
302302
}

src/librustc_trans/back/symbol_export.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use context::SharedCrateContext;
1212
use monomorphize::Instance;
13-
use util::nodemap::FxHashMap;
13+
use rustc::util::nodemap::FxHashMap;
1414
use rustc::hir::def_id::{DefId, CrateNum, LOCAL_CRATE};
1515
use rustc::session::config;
1616
use rustc::ty::TyCtxt;

src/librustc_trans/back/symbol_names.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -348,16 +348,6 @@ impl ItemPathBuffer for SymbolPathBuffer {
348348
}
349349
}
350350

351-
pub fn exported_name_from_type_and_prefix<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
352-
t: Ty<'tcx>,
353-
prefix: &str)
354-
-> String {
355-
let hash = get_symbol_hash(tcx, None, t, None);
356-
let mut buffer = SymbolPathBuffer::new();
357-
buffer.push(prefix);
358-
buffer.finish(hash)
359-
}
360-
361351
// Name sanitation. LLVM will happily accept identifiers with weird names, but
362352
// gas doesn't!
363353
// gas accepts the following characters in symbols: a-z, A-Z, 0-9, ., _, $

src/librustc_trans/back/write.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,15 @@ use back::lto;
1212
use back::link::{get_linker, remove};
1313
use back::symbol_export::ExportedSymbols;
1414
use rustc_incremental::{save_trans_partition, in_incr_comp_dir};
15-
use session::config::{OutputFilenames, OutputTypes, Passes, SomePasses, AllPasses, Sanitizer};
16-
use session::Session;
17-
use session::config::{self, OutputType};
15+
use rustc::session::config::{self, OutputFilenames, OutputType, OutputTypes, Passes, SomePasses,
16+
AllPasses, Sanitizer};
17+
use rustc::session::Session;
1818
use llvm;
1919
use llvm::{ModuleRef, TargetMachineRef, PassManagerRef, DiagnosticInfoRef, ContextRef};
2020
use llvm::SMDiagnosticRef;
2121
use {CrateTranslation, ModuleLlvm, ModuleSource, ModuleTranslation};
22-
use util::common::{time, time_depth, set_time_depth};
23-
use util::common::path2cstr;
24-
use util::fs::link_or_copy;
22+
use rustc::util::common::{time, time_depth, set_time_depth, path2cstr};
23+
use rustc::util::fs::link_or_copy;
2524
use errors::{self, Handler, Level, DiagnosticBuilder};
2625
use errors::emitter::Emitter;
2726
use syntax_pos::MultiSpan;

src/librustc_trans/base.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ use llvm::{ContextRef, Linkage, ModuleRef, ValueRef, Vector, get_param};
3636
use llvm;
3737
use metadata;
3838
use rustc::hir::def_id::LOCAL_CRATE;
39-
use middle::lang_items::StartFnLangItem;
40-
use middle::cstore::EncodedMetadata;
39+
use rustc::middle::lang_items::StartFnLangItem;
40+
use rustc::middle::cstore::EncodedMetadata;
4141
use rustc::ty::{self, Ty, TyCtxt};
4242
use rustc::dep_graph::AssertDepGraphSafe;
4343
use rustc::middle::cstore::LinkMeta;
4444
use rustc::hir::map as hir_map;
4545
use rustc::util::common::time;
46-
use session::config::{self, NoDebugInfo};
46+
use rustc::session::config::{self, NoDebugInfo};
47+
use rustc::session::{self, DataTypeKind, Session};
4748
use rustc_incremental::IncrementalHashesMap;
48-
use session::{self, DataTypeKind, Session};
4949
use abi;
5050
use mir::lvalue::LvalueRef;
5151
use attributes;
@@ -71,7 +71,7 @@ use trans_item::{TransItem, DefPathBasedNames};
7171
use type_::Type;
7272
use type_of;
7373
use value::Value;
74-
use util::nodemap::{NodeSet, FxHashMap, FxHashSet};
74+
use rustc::util::nodemap::{NodeSet, FxHashMap, FxHashSet};
7575

7676
use libc::c_uint;
7777
use std::ffi::{CStr, CString};

src/librustc_trans/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ use rustc::mir::visit::Visitor as MirVisitor;
204204
use context::SharedCrateContext;
205205
use common::{def_ty, instance_ty};
206206
use monomorphize::{self, Instance};
207-
use util::nodemap::{FxHashSet, FxHashMap, DefIdMap};
207+
use rustc::util::nodemap::{FxHashSet, FxHashMap, DefIdMap};
208208

209209
use trans_item::{TransItem, DefPathBasedNames, InstantiationMode};
210210

src/librustc_trans/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use llvm::{ValueRef, ContextRef, TypeKind};
1717
use llvm::{True, False, Bool, OperandBundleDef};
1818
use rustc::hir::def_id::DefId;
1919
use rustc::hir::map::DefPathData;
20-
use middle::lang_items::LangItem;
20+
use rustc::middle::lang_items::LangItem;
2121
use base;
2222
use builder::Builder;
2323
use consts;

0 commit comments

Comments
 (0)