@@ -30,7 +30,7 @@ use crate::errors;
30
30
/// and prevent inspection of linker output in case of errors, which we occasionally do.
31
31
/// This should be acceptable because other messages from rustc are in English anyway,
32
32
/// 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 ) {
34
34
// No harm in setting both env vars simultaneously.
35
35
// Unix-style linkers.
36
36
linker. env ( "LC_ALL" , "C" ) ;
@@ -41,7 +41,7 @@ pub fn disable_localization(linker: &mut Command) {
41
41
/// The third parameter is for env vars, used on windows to set up the
42
42
/// path for MSVC to find its DLLs, and gcc to find its bundled
43
43
/// toolchain
44
- pub fn get_linker < ' a > (
44
+ pub ( crate ) fn get_linker < ' a > (
45
45
sess : & ' a Session ,
46
46
linker : & Path ,
47
47
flavor : LinkerFlavor ,
@@ -215,28 +215,36 @@ fn link_or_cc_args<L: Linker + ?Sized>(
215
215
macro_rules! generate_arg_methods {
216
216
( $( $ty: ty) * ) => { $(
217
217
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 {
219
220
verbatim_args( self , args)
220
221
}
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 {
222
224
verbatim_args( self , iter:: once( arg) )
223
225
}
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 {
225
228
link_args( self , args)
226
229
}
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 {
228
232
link_args( self , iter:: once( arg) )
229
233
}
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 {
231
236
cc_args( self , args)
232
237
}
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 {
234
240
cc_args( self , iter:: once( arg) )
235
241
}
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 {
237
244
link_or_cc_args( self , args)
238
245
}
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 {
240
248
link_or_cc_args( self , iter:: once( arg) )
241
249
}
242
250
}
@@ -263,7 +271,7 @@ generate_arg_methods! {
263
271
/// represents the meaning of each option being passed down. This trait is then
264
272
/// used to dispatch on whether a GNU-like linker (generally `ld.exe`) or an
265
273
/// MSVC linker (e.g., `link.exe`) is being used.
266
- pub trait Linker {
274
+ pub ( crate ) trait Linker {
267
275
fn cmd ( & mut self ) -> & mut Command ;
268
276
fn is_cc ( & self ) -> bool {
269
277
false
@@ -314,12 +322,12 @@ pub trait Linker {
314
322
}
315
323
316
324
impl dyn Linker + ' _ {
317
- pub fn take_cmd ( & mut self ) -> Command {
325
+ pub ( crate ) fn take_cmd ( & mut self ) -> Command {
318
326
mem:: replace ( self . cmd ( ) , Command :: new ( "" ) )
319
327
}
320
328
}
321
329
322
- pub struct GccLinker < ' a > {
330
+ struct GccLinker < ' a > {
323
331
cmd : Command ,
324
332
sess : & ' a Session ,
325
333
target_cpu : & ' a str ,
@@ -849,7 +857,7 @@ impl<'a> Linker for GccLinker<'a> {
849
857
}
850
858
}
851
859
852
- pub struct MsvcLinker < ' a > {
860
+ struct MsvcLinker < ' a > {
853
861
cmd : Command ,
854
862
sess : & ' a Session ,
855
863
}
@@ -1103,7 +1111,7 @@ impl<'a> Linker for MsvcLinker<'a> {
1103
1111
}
1104
1112
}
1105
1113
1106
- pub struct EmLinker < ' a > {
1114
+ struct EmLinker < ' a > {
1107
1115
cmd : Command ,
1108
1116
sess : & ' a Session ,
1109
1117
}
@@ -1220,7 +1228,7 @@ impl<'a> Linker for EmLinker<'a> {
1220
1228
}
1221
1229
}
1222
1230
1223
- pub struct WasmLd < ' a > {
1231
+ struct WasmLd < ' a > {
1224
1232
cmd : Command ,
1225
1233
sess : & ' a Session ,
1226
1234
}
@@ -1404,7 +1412,7 @@ impl<'a> WasmLd<'a> {
1404
1412
}
1405
1413
1406
1414
/// Linker shepherd script for L4Re (Fiasco)
1407
- pub struct L4Bender < ' a > {
1415
+ struct L4Bender < ' a > {
1408
1416
cmd : Command ,
1409
1417
sess : & ' a Session ,
1410
1418
hinted_static : bool ,
@@ -1510,7 +1518,7 @@ impl<'a> Linker for L4Bender<'a> {
1510
1518
}
1511
1519
1512
1520
impl < ' a > L4Bender < ' a > {
1513
- pub fn new ( cmd : Command , sess : & ' a Session ) -> L4Bender < ' a > {
1521
+ fn new ( cmd : Command , sess : & ' a Session ) -> L4Bender < ' a > {
1514
1522
L4Bender { cmd, sess, hinted_static : false }
1515
1523
}
1516
1524
@@ -1523,14 +1531,14 @@ impl<'a> L4Bender<'a> {
1523
1531
}
1524
1532
1525
1533
/// Linker for AIX.
1526
- pub struct AixLinker < ' a > {
1534
+ struct AixLinker < ' a > {
1527
1535
cmd : Command ,
1528
1536
sess : & ' a Session ,
1529
1537
hinted_static : Option < bool > ,
1530
1538
}
1531
1539
1532
1540
impl < ' a > AixLinker < ' a > {
1533
- pub fn new ( cmd : Command , sess : & ' a Session ) -> AixLinker < ' a > {
1541
+ fn new ( cmd : Command , sess : & ' a Session ) -> AixLinker < ' a > {
1534
1542
AixLinker { cmd, sess, hinted_static : None }
1535
1543
}
1536
1544
@@ -1758,7 +1766,7 @@ pub(crate) fn linked_symbols(
1758
1766
1759
1767
/// Much simplified and explicit CLI for the NVPTX linker. The linker operates
1760
1768
/// with bitcode and uses LLVM backend to generate a PTX assembly.
1761
- pub struct PtxLinker < ' a > {
1769
+ struct PtxLinker < ' a > {
1762
1770
cmd : Command ,
1763
1771
sess : & ' a Session ,
1764
1772
}
@@ -1824,7 +1832,7 @@ impl<'a> Linker for PtxLinker<'a> {
1824
1832
}
1825
1833
1826
1834
/// The `self-contained` LLVM bitcode linker
1827
- pub struct LlbcLinker < ' a > {
1835
+ struct LlbcLinker < ' a > {
1828
1836
cmd : Command ,
1829
1837
sess : & ' a Session ,
1830
1838
}
@@ -1895,7 +1903,7 @@ impl<'a> Linker for LlbcLinker<'a> {
1895
1903
fn linker_plugin_lto ( & mut self ) { }
1896
1904
}
1897
1905
1898
- pub struct BpfLinker < ' a > {
1906
+ struct BpfLinker < ' a > {
1899
1907
cmd : Command ,
1900
1908
sess : & ' a Session ,
1901
1909
}
0 commit comments