about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorMartin Nordholts <enselic@gmail.com>2022-08-31 18:04:15 +0200
committerMartin Nordholts <enselic@gmail.com>2022-08-31 18:20:49 +0200
commit236903f7e9045717d7795ab12bdf349ccf276c3b (patch)
treeca627d24025b828c3941ef3472c126810dc79a51 /library/std/src
parent6eae169ca2206671779b5b405052417a182a47e9 (diff)
downloadrust-236903f7e9045717d7795ab12bdf349ccf276c3b.tar.gz
rust-236903f7e9045717d7795ab12bdf349ccf276c3b.zip
unix_sigpipe: Inline compiler sigpipe constants in std
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/sys/unix/mod.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/library/std/src/sys/unix/mod.rs b/library/std/src/sys/unix/mod.rs
index e11201f60ff..d701f950e86 100644
--- a/library/std/src/sys/unix/mod.rs
+++ b/library/std/src/sys/unix/mod.rs
@@ -155,10 +155,16 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
     unsafe fn reset_sigpipe(#[allow(unused_variables)] sigpipe: u8) {
         #[cfg(not(any(target_os = "emscripten", target_os = "fuchsia", target_os = "horizon")))]
         {
-            // We don't want to add this as a public type to libstd, nor do we want to
-            // duplicate the code, so we choose to include this compiler file like this.
+            // We don't want to add this as a public type to libstd, nor do we
+            // want to `include!` a file from the compiler (which would break
+            // Miri and xargo for example), so we choose to duplicate these
+            // constants from `compiler/rustc_session/src/config/sigpipe.rs`.
+            // See the other file for docs. NOTE: Make sure to keep them in
+            // sync!
             mod sigpipe {
-                include!("../../../../../compiler/rustc_session/src/config/sigpipe.rs");
+                pub const INHERIT: u8 = 1;
+                pub const SIG_IGN: u8 = 2;
+                pub const SIG_DFL: u8 = 3;
             }
 
             let handler = match sigpipe {