@@ -28,7 +28,7 @@ use crate::errors;
2828/// and prevent inspection of linker output in case of errors, which we occasionally do.
2929/// This should be acceptable because other messages from rustc are in English anyway,
3030/// and may also be desirable to improve searchability of the linker diagnostics.
31- pub fn disable_localization ( linker : & mut Command ) {
31+ pub ( crate ) fn disable_localization ( linker : & mut Command ) {
3232 // No harm in setting both env vars simultaneously.
3333 // Unix-style linkers.
3434 linker. env ( "LC_ALL" , "C" ) ;
@@ -39,7 +39,7 @@ pub fn disable_localization(linker: &mut Command) {
3939/// The third parameter is for env vars, used on windows to set up the
4040/// path for MSVC to find its DLLs, and gcc to find its bundled
4141/// toolchain
42- pub fn get_linker < ' a > (
42+ pub ( crate ) fn get_linker < ' a > (
4343 sess : & ' a Session ,
4444 linker : & Path ,
4545 flavor : LinkerFlavor ,
@@ -213,28 +213,36 @@ fn link_or_cc_args<L: Linker + ?Sized>(
213213macro_rules! generate_arg_methods {
214214 ( $( $ty: ty) * ) => { $(
215215 impl $ty {
216- pub fn verbatim_args( & mut self , args: impl IntoIterator <Item : AsRef <OsStr >>) -> & mut Self {
216+ #[ allow( unused) ]
217+ pub ( crate ) fn verbatim_args( & mut self , args: impl IntoIterator <Item : AsRef <OsStr >>) -> & mut Self {
217218 verbatim_args( self , args)
218219 }
219- pub fn verbatim_arg( & mut self , arg: impl AsRef <OsStr >) -> & mut Self {
220+ #[ allow( unused) ]
221+ pub ( crate ) fn verbatim_arg( & mut self , arg: impl AsRef <OsStr >) -> & mut Self {
220222 verbatim_args( self , iter:: once( arg) )
221223 }
222- pub fn link_args( & mut self , args: impl IntoIterator <Item : AsRef <OsStr >, IntoIter : ExactSizeIterator >) -> & mut Self {
224+ #[ allow( unused) ]
225+ pub ( crate ) fn link_args( & mut self , args: impl IntoIterator <Item : AsRef <OsStr >, IntoIter : ExactSizeIterator >) -> & mut Self {
223226 link_args( self , args)
224227 }
225- pub fn link_arg( & mut self , arg: impl AsRef <OsStr >) -> & mut Self {
228+ #[ allow( unused) ]
229+ pub ( crate ) fn link_arg( & mut self , arg: impl AsRef <OsStr >) -> & mut Self {
226230 link_args( self , iter:: once( arg) )
227231 }
228- pub fn cc_args( & mut self , args: impl IntoIterator <Item : AsRef <OsStr >>) -> & mut Self {
232+ #[ allow( unused) ]
233+ pub ( crate ) fn cc_args( & mut self , args: impl IntoIterator <Item : AsRef <OsStr >>) -> & mut Self {
229234 cc_args( self , args)
230235 }
231- pub fn cc_arg( & mut self , arg: impl AsRef <OsStr >) -> & mut Self {
236+ #[ allow( unused) ]
237+ pub ( crate ) fn cc_arg( & mut self , arg: impl AsRef <OsStr >) -> & mut Self {
232238 cc_args( self , iter:: once( arg) )
233239 }
234- pub fn link_or_cc_args( & mut self , args: impl IntoIterator <Item : AsRef <OsStr >>) -> & mut Self {
240+ #[ allow( unused) ]
241+ pub ( crate ) fn link_or_cc_args( & mut self , args: impl IntoIterator <Item : AsRef <OsStr >>) -> & mut Self {
235242 link_or_cc_args( self , args)
236243 }
237- pub fn link_or_cc_arg( & mut self , arg: impl AsRef <OsStr >) -> & mut Self {
244+ #[ allow( unused) ]
245+ pub ( crate ) fn link_or_cc_arg( & mut self , arg: impl AsRef <OsStr >) -> & mut Self {
238246 link_or_cc_args( self , iter:: once( arg) )
239247 }
240248 }
@@ -261,7 +269,7 @@ generate_arg_methods! {
261269/// represents the meaning of each option being passed down. This trait is then
262270/// used to dispatch on whether a GNU-like linker (generally `ld.exe`) or an
263271/// MSVC linker (e.g., `link.exe`) is being used.
264- pub trait Linker {
272+ pub ( crate ) trait Linker {
265273 fn cmd ( & mut self ) -> & mut Command ;
266274 fn is_cc ( & self ) -> bool {
267275 false
@@ -312,12 +320,12 @@ pub trait Linker {
312320}
313321
314322impl dyn Linker + ' _ {
315- pub fn take_cmd ( & mut self ) -> Command {
323+ pub ( crate ) fn take_cmd ( & mut self ) -> Command {
316324 mem:: replace ( self . cmd ( ) , Command :: new ( "" ) )
317325 }
318326}
319327
320- pub struct GccLinker < ' a > {
328+ struct GccLinker < ' a > {
321329 cmd : Command ,
322330 sess : & ' a Session ,
323331 target_cpu : & ' a str ,
@@ -847,7 +855,7 @@ impl<'a> Linker for GccLinker<'a> {
847855 }
848856}
849857
850- pub struct MsvcLinker < ' a > {
858+ struct MsvcLinker < ' a > {
851859 cmd : Command ,
852860 sess : & ' a Session ,
853861}
@@ -1095,7 +1103,7 @@ impl<'a> Linker for MsvcLinker<'a> {
10951103 }
10961104}
10971105
1098- pub struct EmLinker < ' a > {
1106+ struct EmLinker < ' a > {
10991107 cmd : Command ,
11001108 sess : & ' a Session ,
11011109}
@@ -1212,7 +1220,7 @@ impl<'a> Linker for EmLinker<'a> {
12121220 }
12131221}
12141222
1215- pub struct WasmLd < ' a > {
1223+ struct WasmLd < ' a > {
12161224 cmd : Command ,
12171225 sess : & ' a Session ,
12181226}
@@ -1396,7 +1404,7 @@ impl<'a> WasmLd<'a> {
13961404}
13971405
13981406/// Linker shepherd script for L4Re (Fiasco)
1399- pub struct L4Bender < ' a > {
1407+ struct L4Bender < ' a > {
14001408 cmd : Command ,
14011409 sess : & ' a Session ,
14021410 hinted_static : bool ,
@@ -1502,7 +1510,7 @@ impl<'a> Linker for L4Bender<'a> {
15021510}
15031511
15041512impl < ' a > L4Bender < ' a > {
1505- pub fn new ( cmd : Command , sess : & ' a Session ) -> L4Bender < ' a > {
1513+ fn new ( cmd : Command , sess : & ' a Session ) -> L4Bender < ' a > {
15061514 L4Bender { cmd, sess, hinted_static : false }
15071515 }
15081516
@@ -1515,14 +1523,14 @@ impl<'a> L4Bender<'a> {
15151523}
15161524
15171525/// Linker for AIX.
1518- pub struct AixLinker < ' a > {
1526+ struct AixLinker < ' a > {
15191527 cmd : Command ,
15201528 sess : & ' a Session ,
15211529 hinted_static : Option < bool > ,
15221530}
15231531
15241532impl < ' a > AixLinker < ' a > {
1525- pub fn new ( cmd : Command , sess : & ' a Session ) -> AixLinker < ' a > {
1533+ fn new ( cmd : Command , sess : & ' a Session ) -> AixLinker < ' a > {
15261534 AixLinker { cmd, sess, hinted_static : None }
15271535 }
15281536
@@ -1750,7 +1758,7 @@ pub(crate) fn linked_symbols(
17501758
17511759/// Much simplified and explicit CLI for the NVPTX linker. The linker operates
17521760/// with bitcode and uses LLVM backend to generate a PTX assembly.
1753- pub struct PtxLinker < ' a > {
1761+ struct PtxLinker < ' a > {
17541762 cmd : Command ,
17551763 sess : & ' a Session ,
17561764}
@@ -1816,7 +1824,7 @@ impl<'a> Linker for PtxLinker<'a> {
18161824}
18171825
18181826/// The `self-contained` LLVM bitcode linker
1819- pub struct LlbcLinker < ' a > {
1827+ struct LlbcLinker < ' a > {
18201828 cmd : Command ,
18211829 sess : & ' a Session ,
18221830}
@@ -1887,7 +1895,7 @@ impl<'a> Linker for LlbcLinker<'a> {
18871895 fn linker_plugin_lto ( & mut self ) { }
18881896}
18891897
1890- pub struct BpfLinker < ' a > {
1898+ struct BpfLinker < ' a > {
18911899 cmd : Command ,
18921900 sess : & ' a Session ,
18931901}
0 commit comments