Skip to content

Commit 236903f

Browse files
committed
unix_sigpipe: Inline compiler sigpipe constants in std
1 parent 6eae169 commit 236903f

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Diff for: compiler/rustc_session/src/config/sigpipe.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! NOTE: Keep these constants in sync with `library/std/src/sys/unix/mod.rs`!
2+
13
/// Do not touch `SIGPIPE`. Use whatever the parent process uses.
24
#[allow(dead_code)]
35
pub const INHERIT: u8 = 1;

Diff for: library/std/src/sys/unix/mod.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,16 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
155155
unsafe fn reset_sigpipe(#[allow(unused_variables)] sigpipe: u8) {
156156
#[cfg(not(any(target_os = "emscripten", target_os = "fuchsia", target_os = "horizon")))]
157157
{
158-
// We don't want to add this as a public type to libstd, nor do we want to
159-
// duplicate the code, so we choose to include this compiler file like this.
158+
// We don't want to add this as a public type to libstd, nor do we
159+
// want to `include!` a file from the compiler (which would break
160+
// Miri and xargo for example), so we choose to duplicate these
161+
// constants from `compiler/rustc_session/src/config/sigpipe.rs`.
162+
// See the other file for docs. NOTE: Make sure to keep them in
163+
// sync!
160164
mod sigpipe {
161-
include!("../../../../../compiler/rustc_session/src/config/sigpipe.rs");
165+
pub const INHERIT: u8 = 1;
166+
pub const SIG_IGN: u8 = 2;
167+
pub const SIG_DFL: u8 = 3;
162168
}
163169

164170
let handler = match sigpipe {

0 commit comments

Comments
 (0)