Skip to content

Commit 6dffaa9

Browse files
committed
Hide even more of rustc_trans
1 parent bd2e808 commit 6dffaa9

File tree

5 files changed

+31
-31
lines changed

5 files changed

+31
-31
lines changed

src/librustc_trans/allocator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use rustc_allocator::{ALLOCATOR_METHODS, AllocatorTy};
1919
use ModuleLlvm;
2020
use llvm::{self, False, True};
2121

22-
pub unsafe fn trans(tcx: TyCtxt, mods: &ModuleLlvm, kind: AllocatorKind) {
22+
pub(crate) unsafe fn trans(tcx: TyCtxt, mods: &ModuleLlvm, kind: AllocatorKind) {
2323
let llcx = mods.llcx;
2424
let llmod = mods.llmod;
2525
let usize = match &tcx.sess.target.target.target_pointer_width[..] {

src/librustc_trans/back/link.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ pub fn remove(sess: &Session, path: &Path) {
141141

142142
/// Perform the linkage portion of the compilation phase. This will generate all
143143
/// of the requested outputs for this compilation session.
144-
pub fn link_binary(sess: &Session,
145-
trans: &CrateTranslation,
146-
outputs: &OutputFilenames,
147-
crate_name: &str) -> Vec<PathBuf> {
144+
pub(crate) fn link_binary(sess: &Session,
145+
trans: &CrateTranslation,
146+
outputs: &OutputFilenames,
147+
crate_name: &str) -> Vec<PathBuf> {
148148
let mut out_filenames = Vec::new();
149149
for &crate_type in sess.crate_types.borrow().iter() {
150150
// Ignore executable crates if we have -Z no-trans, as they will error.
@@ -201,9 +201,9 @@ fn filename_for_metadata(sess: &Session, crate_name: &str, outputs: &OutputFilen
201201
out_filename
202202
}
203203

204-
pub fn each_linked_rlib(sess: &Session,
205-
info: &CrateInfo,
206-
f: &mut FnMut(CrateNum, &Path)) -> Result<(), String> {
204+
pub(crate) fn each_linked_rlib(sess: &Session,
205+
info: &CrateInfo,
206+
f: &mut FnMut(CrateNum, &Path)) -> Result<(), String> {
207207
let crates = info.used_crates_static.iter();
208208
let fmts = sess.dependency_formats.borrow();
209209
let fmts = fmts.get(&config::CrateTypeExecutable)
@@ -247,7 +247,7 @@ pub fn each_linked_rlib(sess: &Session,
247247
/// It's unusual for a crate to not participate in LTO. Typically only
248248
/// compiler-specific and unstable crates have a reason to not participate in
249249
/// LTO.
250-
pub fn ignored_for_lto(sess: &Session, info: &CrateInfo, cnum: CrateNum) -> bool {
250+
pub(crate) fn ignored_for_lto(sess: &Session, info: &CrateInfo, cnum: CrateNum) -> bool {
251251
// If our target enables builtin function lowering in LLVM then the
252252
// crates providing these functions don't participate in LTO (e.g.
253253
// no_builtins or compiler builtins crates).

src/librustc_trans/back/lto.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn crate_type_allows_lto(crate_type: config::CrateType) -> bool {
4242
}
4343
}
4444

45-
pub enum LtoModuleTranslation {
45+
pub(crate) enum LtoModuleTranslation {
4646
Fat {
4747
module: Option<ModuleTranslation>,
4848
_serialized_bitcode: Vec<SerializedModule>,
@@ -65,9 +65,9 @@ impl LtoModuleTranslation {
6565
/// points to LLVM data structures owned by this `LtoModuleTranslation`.
6666
/// It's intended that the module returned is immediately code generated and
6767
/// dropped, and then this LTO module is dropped.
68-
pub unsafe fn optimize(&mut self,
69-
cgcx: &CodegenContext,
70-
timeline: &mut Timeline)
68+
pub(crate) unsafe fn optimize(&mut self,
69+
cgcx: &CodegenContext,
70+
timeline: &mut Timeline)
7171
-> Result<ModuleTranslation, FatalError>
7272
{
7373
match *self {
@@ -100,7 +100,7 @@ pub enum LTOMode {
100100
JustThisCrate,
101101
}
102102

103-
pub fn run(cgcx: &CodegenContext,
103+
pub(crate) fn run(cgcx: &CodegenContext,
104104
modules: Vec<ModuleTranslation>,
105105
mode: LTOMode,
106106
timeline: &mut Timeline)

src/librustc_trans/back/write.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -363,15 +363,15 @@ impl CodegenContext {
363363
Handler::with_emitter(true, false, Box::new(self.diag_emitter.clone()))
364364
}
365365

366-
pub fn config(&self, kind: ModuleKind) -> &ModuleConfig {
366+
pub(crate) fn config(&self, kind: ModuleKind) -> &ModuleConfig {
367367
match kind {
368368
ModuleKind::Regular => &self.regular_module_config,
369369
ModuleKind::Metadata => &self.metadata_module_config,
370370
ModuleKind::Allocator => &self.allocator_module_config,
371371
}
372372
}
373373

374-
pub fn save_temp_bitcode(&self, trans: &ModuleTranslation, name: &str) {
374+
pub(crate) fn save_temp_bitcode(&self, trans: &ModuleTranslation, name: &str) {
375375
if !self.save_temps {
376376
return
377377
}
@@ -822,7 +822,7 @@ fn binaryen_assemble(cgcx: &CodegenContext,
822822
}
823823
}
824824

825-
pub struct CompiledModules {
825+
pub(crate) struct CompiledModules {
826826
pub modules: Vec<CompiledModule>,
827827
pub metadata_module: CompiledModule,
828828
pub allocator_module: Option<CompiledModule>,
@@ -1162,7 +1162,7 @@ fn produce_final_output_artifacts(sess: &Session,
11621162
// These are used in linking steps and will be cleaned up afterward.
11631163
}
11641164

1165-
pub fn dump_incremental_data(trans: &CrateTranslation) {
1165+
pub(crate) fn dump_incremental_data(trans: &CrateTranslation) {
11661166
println!("[incremental] Re-using {} out of {} modules",
11671167
trans.modules.iter().filter(|m| m.pre_existing).count(),
11681168
trans.modules.len());
@@ -2144,7 +2144,7 @@ pub struct OngoingCrateTranslation {
21442144
}
21452145

21462146
impl OngoingCrateTranslation {
2147-
pub fn join(self, sess: &Session, dep_graph: &DepGraph) -> CrateTranslation {
2147+
pub(crate) fn join(self, sess: &Session, dep_graph: &DepGraph) -> CrateTranslation {
21482148
self.shared_emitter_main.check(sess, true);
21492149
let compiled_modules = match self.future.join() {
21502150
Ok(Ok(compiled_modules)) => compiled_modules,
@@ -2212,9 +2212,9 @@ impl OngoingCrateTranslation {
22122212
trans
22132213
}
22142214

2215-
pub fn submit_pre_translated_module_to_llvm(&self,
2216-
tcx: TyCtxt,
2217-
mtrans: ModuleTranslation) {
2215+
pub(crate) fn submit_pre_translated_module_to_llvm(&self,
2216+
tcx: TyCtxt,
2217+
mtrans: ModuleTranslation) {
22182218
self.wait_for_signal_to_translate_item();
22192219
self.check_for_errors(tcx.sess);
22202220

@@ -2247,9 +2247,9 @@ impl OngoingCrateTranslation {
22472247
}
22482248
}
22492249

2250-
pub fn submit_translated_module_to_llvm(tcx: TyCtxt,
2251-
mtrans: ModuleTranslation,
2252-
cost: u64) {
2250+
pub(crate) fn submit_translated_module_to_llvm(tcx: TyCtxt,
2251+
mtrans: ModuleTranslation,
2252+
cost: u64) {
22532253
let llvm_work_item = WorkItem::Optimize(mtrans);
22542254
drop(tcx.tx_to_llvm_workers.send(Box::new(Message::TranslationDone {
22552255
llvm_work_item,

src/librustc_trans/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ impl TransCrate for LlvmTransCrate {
250250
}
251251
}
252252

253-
pub struct ModuleTranslation {
253+
struct ModuleTranslation {
254254
/// The name of the module. When the crate may be saved between
255255
/// compilations, incremental compilation requires that name be
256256
/// unique amongst **all** crates. Therefore, it should contain
@@ -263,7 +263,7 @@ pub struct ModuleTranslation {
263263
}
264264

265265
#[derive(Copy, Clone, Debug, PartialEq)]
266-
pub enum ModuleKind {
266+
enum ModuleKind {
267267
Regular,
268268
Metadata,
269269
Allocator,
@@ -316,7 +316,7 @@ impl ModuleTranslation {
316316
}
317317

318318
#[derive(Debug)]
319-
pub struct CompiledModule {
319+
struct CompiledModule {
320320
name: String,
321321
llmod_id: String,
322322
kind: ModuleKind,
@@ -335,7 +335,7 @@ enum ModuleSource {
335335
}
336336

337337
#[derive(Debug)]
338-
pub struct ModuleLlvm {
338+
struct ModuleLlvm {
339339
llcx: llvm::ContextRef,
340340
llmod: llvm::ModuleRef,
341341
tm: llvm::TargetMachineRef,
@@ -354,7 +354,7 @@ impl Drop for ModuleLlvm {
354354
}
355355
}
356356

357-
pub struct CrateTranslation {
357+
struct CrateTranslation {
358358
crate_name: Symbol,
359359
modules: Vec<CompiledModule>,
360360
allocator_module: Option<CompiledModule>,
@@ -367,7 +367,7 @@ pub struct CrateTranslation {
367367
}
368368

369369
// Misc info we load from metadata to persist beyond the tcx
370-
pub struct CrateInfo {
370+
struct CrateInfo {
371371
panic_runtime: Option<CrateNum>,
372372
compiler_builtins: Option<CrateNum>,
373373
profiler_runtime: Option<CrateNum>,

0 commit comments

Comments
 (0)