about summary refs log tree commit diff
path: root/src/liballoc_system
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-01-05 10:07:47 +0000
committerbors <bors@rust-lang.org>2018-01-05 10:07:47 +0000
commitdd582ac38ec066859334061e71faf2631220d98b (patch)
treec77ea210e9d64e5e93e4460daffa6629d0e21bf7 /src/liballoc_system
parent8a11b8cdd7cc7214c2bb9e77a6c961dd4dad9b7c (diff)
parent3fcb99575962660be1989e7176dd36444f6fa41b (diff)
downloadrust-dd582ac38ec066859334061e71faf2631220d98b.tar.gz
rust-dd582ac38ec066859334061e71faf2631220d98b.zip
Auto merge of #47214 - kennytm:rollup, r=kennytm
Rollup of 10 pull requests

- Successful merges: #47030, #47033, #47110, #47149, #47150, #47160, #47162, #47182, #47198, #47199
- Failed merges:
Diffstat (limited to 'src/liballoc_system')
-rw-r--r--src/liballoc_system/lib.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/liballoc_system/lib.rs b/src/liballoc_system/lib.rs
index 27259cc31a5..1d5e7b73be5 100644
--- a/src/liballoc_system/lib.rs
+++ b/src/liballoc_system/lib.rs
@@ -21,7 +21,7 @@
 #![feature(core_intrinsics)]
 #![feature(staged_api)]
 #![feature(rustc_attrs)]
-#![cfg_attr(any(unix, target_os = "redox"), feature(libc))]
+#![cfg_attr(any(unix, target_os = "cloudabi", target_os = "redox"), feature(libc))]
 #![rustc_alloc_kind = "lib"]
 
 // The minimum alignment guaranteed by the architecture. This value is used to
@@ -116,7 +116,7 @@ unsafe impl Alloc for System {
     }
 }
 
-#[cfg(any(unix, target_os = "redox"))]
+#[cfg(any(unix, target_os = "cloudabi", target_os = "redox"))]
 mod platform {
     extern crate libc;
 
@@ -213,6 +213,16 @@ mod platform {
             struct Stderr;
 
             impl Write for Stderr {
+                #[cfg(target_os = "cloudabi")]
+                fn write_str(&mut self, _: &str) -> fmt::Result {
+                    // CloudABI does not have any reserved file descriptor
+                    // numbers. We should not attempt to write to file
+                    // descriptor #2, as it may be associated with any kind of
+                    // resource.
+                    Ok(())
+                }
+
+                #[cfg(not(target_os = "cloudabi"))]
                 fn write_str(&mut self, s: &str) -> fmt::Result {
                     unsafe {
                         libc::write(libc::STDERR_FILENO,