Skip to content
Merged
3 changes: 1 addition & 2 deletions compiler/rustc_errors/src/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2698,8 +2698,7 @@ impl HumanEmitter {
[SubstitutionHighlight { start: 0, end }] if *end == line_to_add.len() => {
buffer.puts(*row_num, max_line_num_len + 1, "+ ", Style::Addition);
}
[] => {
// FIXME: needed? Doesn't get exercised in any test.
[] | [SubstitutionHighlight { start: 0, end: 0 }] => {
self.draw_col_separator_no_space(buffer, *row_num, max_line_num_len + 1);
}
_ => {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ impl Input {
}
}

#[derive(Clone, Hash, Debug, HashStable_Generic, PartialEq, Encodable, Decodable)]
#[derive(Clone, Hash, Debug, HashStable_Generic, PartialEq, Eq, Encodable, Decodable)]
pub enum OutFileName {
Real(PathBuf),
Stdout,
Expand Down
19 changes: 19 additions & 0 deletions library/std/src/os/windows/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,20 @@ pub trait CommandExt: Sealed {
/// [1]: https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-startupinfoa
#[unstable(feature = "windows_process_extensions_startupinfo", issue = "141010")]
fn startupinfo_force_feedback(&mut self, enabled: Option<bool>) -> &mut process::Command;

/// If this flag is set to `true`, each inheritable handle in the calling
/// process is inherited by the new process. If the flag is `false`, the
/// handles are not inherited.
///
/// The default value for this flag is `true`.
///
/// **Note** that inherited handles have the same value and access rights
/// as the original handles. For additional discussion of inheritable handles,
/// see the [Remarks][1] section of the `CreateProcessW` documentation.
///
/// [1]: https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw#remarks
#[unstable(feature = "windows_process_extensions_inherit_handles", issue = "146407")]
fn inherit_handles(&mut self, inherit_handles: bool) -> &mut process::Command;
}

#[stable(feature = "windows_process_extensions", since = "1.16.0")]
Expand Down Expand Up @@ -421,6 +435,11 @@ impl CommandExt for process::Command {
self.as_inner_mut().startupinfo_force_feedback(enabled);
self
}

fn inherit_handles(&mut self, inherit_handles: bool) -> &mut process::Command {
self.as_inner_mut().inherit_handles(inherit_handles);
self
}
}

#[unstable(feature = "windows_process_extensions_main_thread_handle", issue = "96723")]
Expand Down
5 changes: 1 addition & 4 deletions library/std/src/sys/pal/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

use crate::io::ErrorKind;

#[cfg(not(target_os = "espidf"))]
#[macro_use]
pub mod weak;

#[cfg(target_os = "fuchsia")]
pub mod fuchsia;
pub mod futex;
Expand All @@ -19,6 +15,7 @@ pub mod stack_overflow;
pub mod sync;
pub mod thread_parking;
pub mod time;
pub mod weak;

#[cfg(target_os = "espidf")]
pub fn init(_argc: isize, _argv: *const *const u8, _sigpipe: u8) {}
Expand Down
45 changes: 17 additions & 28 deletions library/std/src/sys/pal/unix/stack_overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ mod imp {
use super::Handler;
use super::thread_info::{delete_current_info, set_current_info, with_current_info};
use crate::ops::Range;
use crate::sync::OnceLock;
use crate::sync::atomic::{Atomic, AtomicBool, AtomicPtr, AtomicUsize, Ordering};
use crate::sys::pal::unix::os;
use crate::{io, mem, ptr};
Expand Down Expand Up @@ -406,6 +405,10 @@ mod imp {
} else if cfg!(all(target_os = "linux", target_env = "musl")) {
install_main_guard_linux_musl(page_size)
} else if cfg!(target_os = "freebsd") {
#[cfg(not(target_os = "freebsd"))]
return None;
// The FreeBSD code cannot be checked on non-BSDs.
#[cfg(target_os = "freebsd")]
install_main_guard_freebsd(page_size)
} else if cfg!(any(target_os = "netbsd", target_os = "openbsd")) {
install_main_guard_bsds(page_size)
Expand Down Expand Up @@ -442,6 +445,7 @@ mod imp {
}

#[forbid(unsafe_op_in_unsafe_fn)]
#[cfg(target_os = "freebsd")]
unsafe fn install_main_guard_freebsd(page_size: usize) -> Option<Range<usize>> {
// FreeBSD's stack autogrows, and optionally includes a guard page
// at the bottom. If we try to remap the bottom of the stack
Expand All @@ -453,38 +457,23 @@ mod imp {
// by the security.bsd.stack_guard_page sysctl.
// By default it is 1, checking once is enough since it is
// a boot time config value.
static PAGES: OnceLock<usize> = OnceLock::new();
static PAGES: crate::sync::OnceLock<usize> = crate::sync::OnceLock::new();

let pages = PAGES.get_or_init(|| {
use crate::sys::weak::dlsym;
dlsym!(
fn sysctlbyname(
name: *const libc::c_char,
oldp: *mut libc::c_void,
oldlenp: *mut libc::size_t,
newp: *const libc::c_void,
newlen: libc::size_t,
) -> libc::c_int;
);
let mut guard: usize = 0;
let mut size = size_of_val(&guard);
let oid = c"security.bsd.stack_guard_page";
match sysctlbyname.get() {
Some(fcn)
if unsafe {
fcn(
oid.as_ptr(),
(&raw mut guard).cast(),
&raw mut size,
ptr::null_mut(),
0,
) == 0
} =>
{
guard
}
_ => 1,
}

let r = unsafe {
libc::sysctlbyname(
oid.as_ptr(),
(&raw mut guard).cast(),
&raw mut size,
ptr::null_mut(),
0,
)
};
if r == 0 { guard } else { 1 }
});
Some(guardaddr..guardaddr + pages * page_size)
}
Expand Down
225 changes: 0 additions & 225 deletions library/std/src/sys/pal/unix/weak.rs

This file was deleted.

Loading
Loading