File tree 3 files changed +12
-3
lines changed
3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ align = []
28
28
rustc-dep-of-std = [' align' , ' rustc-std-workspace-core' ]
29
29
extra_traits = []
30
30
const-extern-fn = []
31
+ iconv-apple = []
31
32
# use_std is deprecated, use `std` instead
32
33
use_std = [ ' std' ]
33
34
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ libc = "0.2"
38
38
If you use Rust >= 1.62, this feature is implicitly enabled.
39
39
Otherwise it requires a nightly rustc.
40
40
41
+ * ` iconv-apple ` : Enables usage of ` iconv_open ` , ` iconv ` , and ` iconv_close ` on Apple devices.
42
+
41
43
* ** deprecated** : ` use_std ` is deprecated, and is equivalent to ` std ` .
42
44
43
45
## Rust version support
Original file line number Diff line number Diff line change @@ -5908,9 +5908,15 @@ cfg_if! {
5908
5908
}
5909
5909
5910
5910
// These require a dependency on `libiconv`, and including this when built as
5911
- // part of `std` means every Rust program gets it. Ideally we would have a link
5912
- // modifier to only include these if they are used, but we do not.
5913
- #[ cfg_attr( not( feature = "rustc-dep-of-std" ) , link( name = "iconv" ) ) ]
5911
+ // part of `std` means every Rust program gets it. Additionally, when not built
5912
+ // as part of `std`, merely using `libc` on an Apple target will pull in `libiconv`.
5913
+ //
5914
+ // Therefore, due to these functions very low usage numbers on the platform, we hide it
5915
+ // behind a feature flag.
5916
+ //
5917
+ // Ideally we would have a link modifier to only include these if they are used, but we do not.
5918
+ #[ cfg( feature = "iconv-apple" ) ]
5919
+ #[ link( name = "iconv" ) ]
5914
5920
extern "C" {
5915
5921
pub fn iconv_open ( tocode : * const :: c_char , fromcode : * const :: c_char ) -> iconv_t ;
5916
5922
pub fn iconv (
You can’t perform that action at this time.
0 commit comments