From 493cd6b6e2dfc400c4026f1f2c9b89e97055107e Mon Sep 17 00:00:00 2001 From: Robin Kruppe Date: Sat, 27 May 2017 20:13:32 +0200 Subject: [PATCH] Reduce API surface of rustc_trans Mark various items and fields as private or pub(crate), and remove a function that turns out to be unused. These are not used anywhere in-tree, but I guess it's a [breaking-change] for plugins. --- src/librustc_trans/assert_module_sources.rs | 4 ++-- src/librustc_trans/back/symbol_names.rs | 10 --------- src/librustc_trans/lib.rs | 25 +++++++++------------ 3 files changed, 13 insertions(+), 26 deletions(-) diff --git a/src/librustc_trans/assert_module_sources.rs b/src/librustc_trans/assert_module_sources.rs index 63cfe591ce3..b5ef4aac34c 100644 --- a/src/librustc_trans/assert_module_sources.rs +++ b/src/librustc_trans/assert_module_sources.rs @@ -40,8 +40,8 @@ #[derive(Debug, PartialEq)] enum Disposition { Reused, Translated } -pub fn assert_module_sources<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - modules: &[ModuleTranslation]) { +pub(crate) fn assert_module_sources<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, + modules: &[ModuleTranslation]) { let _ignore = tcx.dep_graph.in_ignore(); if tcx.sess.opts.incremental.is_none() { diff --git a/src/librustc_trans/back/symbol_names.rs b/src/librustc_trans/back/symbol_names.rs index 1aed2932948..8e14335ceac 100644 --- a/src/librustc_trans/back/symbol_names.rs +++ b/src/librustc_trans/back/symbol_names.rs @@ -348,16 +348,6 @@ fn push(&mut self, text: &str) { } } -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, ., _, $ diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index 3ac0d88b90d..cb3bc7bd200 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -63,10 +63,9 @@ 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; +use rustc::session; +use rustc::middle; +use rustc::util; pub use base::trans_crate; pub use back::symbol_names::provide; @@ -75,20 +74,18 @@ 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; -- 2.44.0