Skip to content

Commit 7838ce1

Browse files
committed
Auto merge of #148012 - Zalathar:rollup-ed6cnn8, r=Zalathar
Rollup of 4 pull requests Successful merges: - #115501 (Add new inherit_handles flag to CommandExt trait) - #146629 (std: reorganize the UNIX-internal `weak` module) - #147762 (feat(rustdoc): `--emit=depinfo` output to stdout via `-`) - #148001 (fix: Don't add diff symbol to unchanged lines) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 6244eff + 2f7e07b commit 7838ce1

File tree

23 files changed

+417
-343
lines changed

23 files changed

+417
-343
lines changed

compiler/rustc_errors/src/emitter.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2698,8 +2698,7 @@ impl HumanEmitter {
26982698
[SubstitutionHighlight { start: 0, end }] if *end == line_to_add.len() => {
26992699
buffer.puts(*row_num, max_line_num_len + 1, "+ ", Style::Addition);
27002700
}
2701-
[] => {
2702-
// FIXME: needed? Doesn't get exercised in any test.
2701+
[] | [SubstitutionHighlight { start: 0, end: 0 }] => {
27032702
self.draw_col_separator_no_space(buffer, *row_num, max_line_num_len + 1);
27042703
}
27052704
_ => {

compiler/rustc_session/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ impl Input {
11111111
}
11121112
}
11131113

1114-
#[derive(Clone, Hash, Debug, HashStable_Generic, PartialEq, Encodable, Decodable)]
1114+
#[derive(Clone, Hash, Debug, HashStable_Generic, PartialEq, Eq, Encodable, Decodable)]
11151115
pub enum OutFileName {
11161116
Real(PathBuf),
11171117
Stdout,

library/std/src/os/windows/process.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,20 @@ pub trait CommandExt: Sealed {
365365
/// [1]: https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-startupinfoa
366366
#[unstable(feature = "windows_process_extensions_startupinfo", issue = "141010")]
367367
fn startupinfo_force_feedback(&mut self, enabled: Option<bool>) -> &mut process::Command;
368+
369+
/// If this flag is set to `true`, each inheritable handle in the calling
370+
/// process is inherited by the new process. If the flag is `false`, the
371+
/// handles are not inherited.
372+
///
373+
/// The default value for this flag is `true`.
374+
///
375+
/// **Note** that inherited handles have the same value and access rights
376+
/// as the original handles. For additional discussion of inheritable handles,
377+
/// see the [Remarks][1] section of the `CreateProcessW` documentation.
378+
///
379+
/// [1]: https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw#remarks
380+
#[unstable(feature = "windows_process_extensions_inherit_handles", issue = "146407")]
381+
fn inherit_handles(&mut self, inherit_handles: bool) -> &mut process::Command;
368382
}
369383

370384
#[stable(feature = "windows_process_extensions", since = "1.16.0")]
@@ -421,6 +435,11 @@ impl CommandExt for process::Command {
421435
self.as_inner_mut().startupinfo_force_feedback(enabled);
422436
self
423437
}
438+
439+
fn inherit_handles(&mut self, inherit_handles: bool) -> &mut process::Command {
440+
self.as_inner_mut().inherit_handles(inherit_handles);
441+
self
442+
}
424443
}
425444

426445
#[unstable(feature = "windows_process_extensions_main_thread_handle", issue = "96723")]

library/std/src/sys/pal/unix/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
use crate::io::ErrorKind;
44

5-
#[cfg(not(target_os = "espidf"))]
6-
#[macro_use]
7-
pub mod weak;
8-
95
#[cfg(target_os = "fuchsia")]
106
pub mod fuchsia;
117
pub mod futex;
@@ -19,6 +15,7 @@ pub mod stack_overflow;
1915
pub mod sync;
2016
pub mod thread_parking;
2117
pub mod time;
18+
pub mod weak;
2219

2320
#[cfg(target_os = "espidf")]
2421
pub fn init(_argc: isize, _argv: *const *const u8, _sigpipe: u8) {}

library/std/src/sys/pal/unix/stack_overflow.rs

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ mod imp {
6969
use super::Handler;
7070
use super::thread_info::{delete_current_info, set_current_info, with_current_info};
7171
use crate::ops::Range;
72-
use crate::sync::OnceLock;
7372
use crate::sync::atomic::{Atomic, AtomicBool, AtomicPtr, AtomicUsize, Ordering};
7473
use crate::sys::pal::unix::os;
7574
use crate::{io, mem, ptr};
@@ -406,6 +405,10 @@ mod imp {
406405
} else if cfg!(all(target_os = "linux", target_env = "musl")) {
407406
install_main_guard_linux_musl(page_size)
408407
} else if cfg!(target_os = "freebsd") {
408+
#[cfg(not(target_os = "freebsd"))]
409+
return None;
410+
// The FreeBSD code cannot be checked on non-BSDs.
411+
#[cfg(target_os = "freebsd")]
409412
install_main_guard_freebsd(page_size)
410413
} else if cfg!(any(target_os = "netbsd", target_os = "openbsd")) {
411414
install_main_guard_bsds(page_size)
@@ -442,6 +445,7 @@ mod imp {
442445
}
443446

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

458462
let pages = PAGES.get_or_init(|| {
459-
use crate::sys::weak::dlsym;
460-
dlsym!(
461-
fn sysctlbyname(
462-
name: *const libc::c_char,
463-
oldp: *mut libc::c_void,
464-
oldlenp: *mut libc::size_t,
465-
newp: *const libc::c_void,
466-
newlen: libc::size_t,
467-
) -> libc::c_int;
468-
);
469463
let mut guard: usize = 0;
470464
let mut size = size_of_val(&guard);
471465
let oid = c"security.bsd.stack_guard_page";
472-
match sysctlbyname.get() {
473-
Some(fcn)
474-
if unsafe {
475-
fcn(
476-
oid.as_ptr(),
477-
(&raw mut guard).cast(),
478-
&raw mut size,
479-
ptr::null_mut(),
480-
0,
481-
) == 0
482-
} =>
483-
{
484-
guard
485-
}
486-
_ => 1,
487-
}
466+
467+
let r = unsafe {
468+
libc::sysctlbyname(
469+
oid.as_ptr(),
470+
(&raw mut guard).cast(),
471+
&raw mut size,
472+
ptr::null_mut(),
473+
0,
474+
)
475+
};
476+
if r == 0 { guard } else { 1 }
488477
});
489478
Some(guardaddr..guardaddr + pages * page_size)
490479
}

library/std/src/sys/pal/unix/weak.rs

Lines changed: 0 additions & 225 deletions
This file was deleted.

0 commit comments

Comments
 (0)