Skip to content

Commit 1dec40f

Browse files
committed
unix_sigpipe: Inline compiler sigpipe constants in std
1 parent d6e72ee commit 1dec40f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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)