1
1
use std:: ffi:: { OsStr , OsString } ;
2
2
use std:: fs:: { self , File } ;
3
3
use std:: io:: prelude:: * ;
4
- use std:: io:: { self , BufWriter } ;
5
4
use std:: path:: { Path , PathBuf } ;
6
- use std:: { env, iter, mem, str} ;
5
+ use std:: { env, io , iter, mem, str} ;
7
6
8
7
use cc:: windows_registry;
9
8
use rustc_hir:: def_id:: { CrateNum , LOCAL_CRATE } ;
@@ -754,7 +753,7 @@ impl<'a> Linker for GccLinker<'a> {
754
753
if self . sess . target . is_like_osx {
755
754
// Write a plain, newline-separated list of symbols
756
755
let res: io:: Result < ( ) > = try {
757
- let mut f = BufWriter :: new ( File :: create ( & path) ?) ;
756
+ let mut f = File :: create_buffered ( & path) ?;
758
757
for sym in symbols {
759
758
debug ! ( " _{sym}" ) ;
760
759
writeln ! ( f, "_{sym}" ) ?;
@@ -765,7 +764,7 @@ impl<'a> Linker for GccLinker<'a> {
765
764
}
766
765
} else if is_windows {
767
766
let res: io:: Result < ( ) > = try {
768
- let mut f = BufWriter :: new ( File :: create ( & path) ?) ;
767
+ let mut f = File :: create_buffered ( & path) ?;
769
768
770
769
// .def file similar to MSVC one but without LIBRARY section
771
770
// because LD doesn't like when it's empty
@@ -781,7 +780,7 @@ impl<'a> Linker for GccLinker<'a> {
781
780
} else {
782
781
// Write an LD version script
783
782
let res: io:: Result < ( ) > = try {
784
- let mut f = BufWriter :: new ( File :: create ( & path) ?) ;
783
+ let mut f = File :: create_buffered ( & path) ?;
785
784
writeln ! ( f, "{{" ) ?;
786
785
if !symbols. is_empty ( ) {
787
786
writeln ! ( f, " global:" ) ?;
@@ -1059,7 +1058,7 @@ impl<'a> Linker for MsvcLinker<'a> {
1059
1058
1060
1059
let path = tmpdir. join ( "lib.def" ) ;
1061
1060
let res: io:: Result < ( ) > = try {
1062
- let mut f = BufWriter :: new ( File :: create ( & path) ?) ;
1061
+ let mut f = File :: create_buffered ( & path) ?;
1063
1062
1064
1063
// Start off with the standard module name header and then go
1065
1064
// straight to exports.
@@ -1648,7 +1647,7 @@ impl<'a> Linker for AixLinker<'a> {
1648
1647
fn export_symbols ( & mut self , tmpdir : & Path , _crate_type : CrateType , symbols : & [ String ] ) {
1649
1648
let path = tmpdir. join ( "list.exp" ) ;
1650
1649
let res: io:: Result < ( ) > = try {
1651
- let mut f = BufWriter :: new ( File :: create ( & path) ?) ;
1650
+ let mut f = File :: create_buffered ( & path) ?;
1652
1651
// FIXME: use llvm-nm to generate export list.
1653
1652
for symbol in symbols {
1654
1653
debug ! ( " _{symbol}" ) ;
@@ -1961,7 +1960,7 @@ impl<'a> Linker for BpfLinker<'a> {
1961
1960
fn export_symbols ( & mut self , tmpdir : & Path , _crate_type : CrateType , symbols : & [ String ] ) {
1962
1961
let path = tmpdir. join ( "symbols" ) ;
1963
1962
let res: io:: Result < ( ) > = try {
1964
- let mut f = BufWriter :: new ( File :: create ( & path) ?) ;
1963
+ let mut f = File :: create_buffered ( & path) ?;
1965
1964
for sym in symbols {
1966
1965
writeln ! ( f, "{sym}" ) ?;
1967
1966
}
0 commit comments