@@ -685,18 +685,19 @@ impl<'a> Linker for GccLinker<'a> {
685
685
686
686
if self . sess . target . is_like_osx {
687
687
// Write a plain, newline-separated list of symbols
688
- let res: io:: Result < ( ) > = try {
688
+ let res: io:: Result < ( ) > = ( || {
689
689
let mut f = BufWriter :: new ( File :: create ( & path) ?) ;
690
690
for sym in symbols {
691
691
debug ! ( " _{sym}" ) ;
692
692
writeln ! ( f, "_{sym}" ) ?;
693
693
}
694
- } ;
694
+ Ok ( ( ) )
695
+ } ) ( ) ;
695
696
if let Err ( error) = res {
696
697
self . sess . dcx ( ) . emit_fatal ( errors:: LibDefWriteFailure { error } ) ;
697
698
}
698
699
} else if is_windows {
699
- let res: io:: Result < ( ) > = try {
700
+ let res: io:: Result < ( ) > = ( || {
700
701
let mut f = BufWriter :: new ( File :: create ( & path) ?) ;
701
702
702
703
// .def file similar to MSVC one but without LIBRARY section
@@ -706,13 +707,14 @@ impl<'a> Linker for GccLinker<'a> {
706
707
debug ! ( " _{symbol}" ) ;
707
708
writeln ! ( f, " {symbol}" ) ?;
708
709
}
709
- } ;
710
+ Ok ( ( ) )
711
+ } ) ( ) ;
710
712
if let Err ( error) = res {
711
713
self . sess . dcx ( ) . emit_fatal ( errors:: LibDefWriteFailure { error } ) ;
712
714
}
713
715
} else {
714
716
// Write an LD version script
715
- let res: io:: Result < ( ) > = try {
717
+ let res: io:: Result < ( ) > = ( || {
716
718
let mut f = BufWriter :: new ( File :: create ( & path) ?) ;
717
719
writeln ! ( f, "{{" ) ?;
718
720
if !symbols. is_empty ( ) {
@@ -722,8 +724,8 @@ impl<'a> Linker for GccLinker<'a> {
722
724
writeln ! ( f, " {sym};" ) ?;
723
725
}
724
726
}
725
- writeln ! ( f, "\n local:\n *;\n }};" ) ? ;
726
- } ;
727
+ writeln ! ( f, "\n local:\n *;\n }};" )
728
+ } ) ( ) ;
727
729
if let Err ( error) = res {
728
730
self . sess . dcx ( ) . emit_fatal ( errors:: VersionScriptWriteFailure { error } ) ;
729
731
}
@@ -992,7 +994,7 @@ impl<'a> Linker for MsvcLinker<'a> {
992
994
}
993
995
994
996
let path = tmpdir. join ( "lib.def" ) ;
995
- let res: io:: Result < ( ) > = try {
997
+ let res: io:: Result < ( ) > = ( || {
996
998
let mut f = BufWriter :: new ( File :: create ( & path) ?) ;
997
999
998
1000
// Start off with the standard module name header and then go
@@ -1003,7 +1005,8 @@ impl<'a> Linker for MsvcLinker<'a> {
1003
1005
debug ! ( " _{symbol}" ) ;
1004
1006
writeln ! ( f, " {symbol}" ) ?;
1005
1007
}
1006
- } ;
1008
+ Ok ( ( ) )
1009
+ } ) ( ) ;
1007
1010
if let Err ( error) = res {
1008
1011
self . sess . dcx ( ) . emit_fatal ( errors:: LibDefWriteFailure { error } ) ;
1009
1012
}
@@ -1679,14 +1682,15 @@ impl<'a> Linker for AixLinker<'a> {
1679
1682
1680
1683
fn export_symbols ( & mut self , tmpdir : & Path , _crate_type : CrateType , symbols : & [ String ] ) {
1681
1684
let path = tmpdir. join ( "list.exp" ) ;
1682
- let res: io:: Result < ( ) > = try {
1685
+ let res: io:: Result < ( ) > = ( || {
1683
1686
let mut f = BufWriter :: new ( File :: create ( & path) ?) ;
1684
1687
// FIXME: use llvm-nm to generate export list.
1685
1688
for symbol in symbols {
1686
1689
debug ! ( " _{symbol}" ) ;
1687
1690
writeln ! ( f, " {symbol}" ) ?;
1688
1691
}
1689
- } ;
1692
+ Ok ( ( ) )
1693
+ } ) ( ) ;
1690
1694
if let Err ( e) = res {
1691
1695
self . sess . dcx ( ) . fatal ( format ! ( "failed to write export file: {e}" ) ) ;
1692
1696
}
@@ -1988,12 +1992,13 @@ impl<'a> Linker for BpfLinker<'a> {
1988
1992
1989
1993
fn export_symbols ( & mut self , tmpdir : & Path , _crate_type : CrateType , symbols : & [ String ] ) {
1990
1994
let path = tmpdir. join ( "symbols" ) ;
1991
- let res: io:: Result < ( ) > = try {
1995
+ let res: io:: Result < ( ) > = ( || {
1992
1996
let mut f = BufWriter :: new ( File :: create ( & path) ?) ;
1993
1997
for sym in symbols {
1994
1998
writeln ! ( f, "{sym}" ) ?;
1995
1999
}
1996
- } ;
2000
+ Ok ( ( ) )
2001
+ } ) ( ) ;
1997
2002
if let Err ( error) = res {
1998
2003
self . sess . dcx ( ) . emit_fatal ( errors:: SymbolFileWriteFailure { error } ) ;
1999
2004
} else {
0 commit comments