@@ -30,7 +30,7 @@ use crate::errors;
3030/// and prevent inspection of linker output in case of errors, which we occasionally do.
3131/// This should be acceptable because other messages from rustc are in English anyway,
3232/// and may also be desirable to improve searchability of the linker diagnostics.
33- pub fn disable_localization ( linker : & mut Command ) {
33+ pub ( crate ) fn disable_localization ( linker : & mut Command ) {
3434 // No harm in setting both env vars simultaneously.
3535 // Unix-style linkers.
3636 linker. env ( "LC_ALL" , "C" ) ;
@@ -41,7 +41,7 @@ pub fn disable_localization(linker: &mut Command) {
4141/// The third parameter is for env vars, used on windows to set up the
4242/// path for MSVC to find its DLLs, and gcc to find its bundled
4343/// toolchain
44- pub fn get_linker < ' a > (
44+ pub ( crate ) fn get_linker < ' a > (
4545 sess : & ' a Session ,
4646 linker : & Path ,
4747 flavor : LinkerFlavor ,
@@ -215,28 +215,36 @@ fn link_or_cc_args<L: Linker + ?Sized>(
215215macro_rules! generate_arg_methods {
216216 ( $( $ty: ty) * ) => { $(
217217 impl $ty {
218- pub fn verbatim_args( & mut self , args: impl IntoIterator <Item : AsRef <OsStr >>) -> & mut Self {
218+ #[ allow( unused) ]
219+ pub ( crate ) fn verbatim_args( & mut self , args: impl IntoIterator <Item : AsRef <OsStr >>) -> & mut Self {
219220 verbatim_args( self , args)
220221 }
221- pub fn verbatim_arg( & mut self , arg: impl AsRef <OsStr >) -> & mut Self {
222+ #[ allow( unused) ]
223+ pub ( crate ) fn verbatim_arg( & mut self , arg: impl AsRef <OsStr >) -> & mut Self {
222224 verbatim_args( self , iter:: once( arg) )
223225 }
224- pub fn link_args( & mut self , args: impl IntoIterator <Item : AsRef <OsStr >, IntoIter : ExactSizeIterator >) -> & mut Self {
226+ #[ allow( unused) ]
227+ pub ( crate ) fn link_args( & mut self , args: impl IntoIterator <Item : AsRef <OsStr >, IntoIter : ExactSizeIterator >) -> & mut Self {
225228 link_args( self , args)
226229 }
227- pub fn link_arg( & mut self , arg: impl AsRef <OsStr >) -> & mut Self {
230+ #[ allow( unused) ]
231+ pub ( crate ) fn link_arg( & mut self , arg: impl AsRef <OsStr >) -> & mut Self {
228232 link_args( self , iter:: once( arg) )
229233 }
230- pub fn cc_args( & mut self , args: impl IntoIterator <Item : AsRef <OsStr >>) -> & mut Self {
234+ #[ allow( unused) ]
235+ pub ( crate ) fn cc_args( & mut self , args: impl IntoIterator <Item : AsRef <OsStr >>) -> & mut Self {
231236 cc_args( self , args)
232237 }
233- pub fn cc_arg( & mut self , arg: impl AsRef <OsStr >) -> & mut Self {
238+ #[ allow( unused) ]
239+ pub ( crate ) fn cc_arg( & mut self , arg: impl AsRef <OsStr >) -> & mut Self {
234240 cc_args( self , iter:: once( arg) )
235241 }
236- pub fn link_or_cc_args( & mut self , args: impl IntoIterator <Item : AsRef <OsStr >>) -> & mut Self {
242+ #[ allow( unused) ]
243+ pub ( crate ) fn link_or_cc_args( & mut self , args: impl IntoIterator <Item : AsRef <OsStr >>) -> & mut Self {
237244 link_or_cc_args( self , args)
238245 }
239- pub fn link_or_cc_arg( & mut self , arg: impl AsRef <OsStr >) -> & mut Self {
246+ #[ allow( unused) ]
247+ pub ( crate ) fn link_or_cc_arg( & mut self , arg: impl AsRef <OsStr >) -> & mut Self {
240248 link_or_cc_args( self , iter:: once( arg) )
241249 }
242250 }
@@ -263,7 +271,7 @@ generate_arg_methods! {
263271/// represents the meaning of each option being passed down. This trait is then
264272/// used to dispatch on whether a GNU-like linker (generally `ld.exe`) or an
265273/// MSVC linker (e.g., `link.exe`) is being used.
266- pub trait Linker {
274+ pub ( crate ) trait Linker {
267275 fn cmd ( & mut self ) -> & mut Command ;
268276 fn is_cc ( & self ) -> bool {
269277 false
@@ -314,12 +322,12 @@ pub trait Linker {
314322}
315323
316324impl dyn Linker + ' _ {
317- pub fn take_cmd ( & mut self ) -> Command {
325+ pub ( crate ) fn take_cmd ( & mut self ) -> Command {
318326 mem:: replace ( self . cmd ( ) , Command :: new ( "" ) )
319327 }
320328}
321329
322- pub struct GccLinker < ' a > {
330+ struct GccLinker < ' a > {
323331 cmd : Command ,
324332 sess : & ' a Session ,
325333 target_cpu : & ' a str ,
@@ -849,7 +857,7 @@ impl<'a> Linker for GccLinker<'a> {
849857 }
850858}
851859
852- pub struct MsvcLinker < ' a > {
860+ struct MsvcLinker < ' a > {
853861 cmd : Command ,
854862 sess : & ' a Session ,
855863}
@@ -1103,7 +1111,7 @@ impl<'a> Linker for MsvcLinker<'a> {
11031111 }
11041112}
11051113
1106- pub struct EmLinker < ' a > {
1114+ struct EmLinker < ' a > {
11071115 cmd : Command ,
11081116 sess : & ' a Session ,
11091117}
@@ -1220,7 +1228,7 @@ impl<'a> Linker for EmLinker<'a> {
12201228 }
12211229}
12221230
1223- pub struct WasmLd < ' a > {
1231+ struct WasmLd < ' a > {
12241232 cmd : Command ,
12251233 sess : & ' a Session ,
12261234}
@@ -1404,7 +1412,7 @@ impl<'a> WasmLd<'a> {
14041412}
14051413
14061414/// Linker shepherd script for L4Re (Fiasco)
1407- pub struct L4Bender < ' a > {
1415+ struct L4Bender < ' a > {
14081416 cmd : Command ,
14091417 sess : & ' a Session ,
14101418 hinted_static : bool ,
@@ -1510,7 +1518,7 @@ impl<'a> Linker for L4Bender<'a> {
15101518}
15111519
15121520impl < ' a > L4Bender < ' a > {
1513- pub fn new ( cmd : Command , sess : & ' a Session ) -> L4Bender < ' a > {
1521+ fn new ( cmd : Command , sess : & ' a Session ) -> L4Bender < ' a > {
15141522 L4Bender { cmd, sess, hinted_static : false }
15151523 }
15161524
@@ -1523,14 +1531,14 @@ impl<'a> L4Bender<'a> {
15231531}
15241532
15251533/// Linker for AIX.
1526- pub struct AixLinker < ' a > {
1534+ struct AixLinker < ' a > {
15271535 cmd : Command ,
15281536 sess : & ' a Session ,
15291537 hinted_static : Option < bool > ,
15301538}
15311539
15321540impl < ' a > AixLinker < ' a > {
1533- pub fn new ( cmd : Command , sess : & ' a Session ) -> AixLinker < ' a > {
1541+ fn new ( cmd : Command , sess : & ' a Session ) -> AixLinker < ' a > {
15341542 AixLinker { cmd, sess, hinted_static : None }
15351543 }
15361544
@@ -1758,7 +1766,7 @@ pub(crate) fn linked_symbols(
17581766
17591767/// Much simplified and explicit CLI for the NVPTX linker. The linker operates
17601768/// with bitcode and uses LLVM backend to generate a PTX assembly.
1761- pub struct PtxLinker < ' a > {
1769+ struct PtxLinker < ' a > {
17621770 cmd : Command ,
17631771 sess : & ' a Session ,
17641772}
@@ -1824,7 +1832,7 @@ impl<'a> Linker for PtxLinker<'a> {
18241832}
18251833
18261834/// The `self-contained` LLVM bitcode linker
1827- pub struct LlbcLinker < ' a > {
1835+ struct LlbcLinker < ' a > {
18281836 cmd : Command ,
18291837 sess : & ' a Session ,
18301838}
@@ -1895,7 +1903,7 @@ impl<'a> Linker for LlbcLinker<'a> {
18951903 fn linker_plugin_lto ( & mut self ) { }
18961904}
18971905
1898- pub struct BpfLinker < ' a > {
1906+ struct BpfLinker < ' a > {
18991907 cmd : Command ,
19001908 sess : & ' a Session ,
19011909}
0 commit comments