Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions library/std/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1296,6 +1296,12 @@ impl<'a> ExactSizeIterator for CommandArgs<'a> {
}
}

const fn assert_send<T: core::marker::Send>() {}
const fn assert_sync<T: core::marker::Sync>() {}

const _: () = assert_send::<CommandArgs<'static>>();
const _: () = assert_sync::<CommandArgs<'static>>();

/// An iterator over the command environment variables.
///
/// This struct is created by
Expand Down
5 changes: 5 additions & 0 deletions library/std/src/sys/process/unix/common/cstring_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ pub struct CStringIter<'a> {
iter: crate::slice::Iter<'a, *const c_char>,
}

// SAFETY: `CStringIter` is basically just a `slice::Iter<&'a CStr>`
unsafe impl Send for CStringIter<'_> {}
// SAFETY: `CStringIter` is basically just a `slice::Iter<&'a CStr>`
unsafe impl Sync for CStringIter<'_> {}

impl<'a> Iterator for CStringIter<'a> {
type Item = &'a CStr;
fn next(&mut self) -> Option<&'a CStr> {
Expand Down
Loading