Skip to content

Commit

Permalink
Miscellaneous doc cleanups. (#838)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfishcode authored Sep 20, 2023
1 parent abd6e8e commit cb15bd0
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/backend/libc/io/errno.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use libc_errno::errno;
/// `errno`—An error code.
///
/// The error type for `rustix` APIs. This is similar to [`std::io::Error`],
//// but only holds an OS error code, and no extra error value.
/// but only holds an OS error code, and no extra error value.
///
/// # References
/// - [POSIX]
Expand Down
2 changes: 1 addition & 1 deletion src/backend/linux_raw/io/errno.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use linux_raw_sys::errno;
/// `errno`—An error code.
///
/// The error type for `rustix` APIs. This is similar to [`std::io::Error`],
//// but only holds an OS error code, and no extra error value.
/// but only holds an OS error code, and no extra error value.
///
/// # References
/// - [POSIX]
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ pub mod time;
#[cfg(not(windows))]
#[cfg(feature = "runtime")]
#[cfg(linux_raw)]
#[doc(hidden)]
#[cfg_attr(not(document_experimental_runtime_api), doc(hidden))]
#[cfg_attr(doc_cfg, doc(cfg(feature = "runtime")))]
pub mod runtime;

Expand Down
3 changes: 0 additions & 3 deletions src/net/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::backend::c;
use bitflags::bitflags;

/// A type for holding raw integer socket types.
#[doc(hidden)]
pub type RawSocketType = u32;

/// `SOCK_*` constants for use with [`socket`].
Expand Down Expand Up @@ -48,7 +47,6 @@ impl SocketType {
}

/// A type for holding raw integer address families.
#[doc(hidden)]
pub type RawAddressFamily = c::sa_family_t;

/// `AF_*` constants for use with [`socket`], [`socket_with`], and
Expand Down Expand Up @@ -577,7 +575,6 @@ impl AddressFamily {
}

/// A type for holding raw integer protocols.
#[doc(hidden)]
pub type RawProtocol = core::num::NonZeroU32;

const fn new_raw_protocol(u: u32) -> RawProtocol {
Expand Down
4 changes: 1 addition & 3 deletions src/process/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,9 @@ pub fn setsid() -> io::Result<Pid> {
/// [Linux]: https://man7.org/linux/man-pages/man2/getgroups.2.html
#[cfg(feature = "alloc")]
pub fn getgroups() -> io::Result<Vec<Gid>> {
let mut buffer = Vec::new();

// This code would benefit from having a better way to read into
// uninitialized memory, but that requires `unsafe`.
buffer.reserve(8);
let mut buffer = Vec::with_capacity(8);
buffer.resize(buffer.capacity(), Gid::ROOT);

loop {
Expand Down
14 changes: 10 additions & 4 deletions src/runtime.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Low-level implementation details for libc-like runtime libraries such as
//! [origin].
//! Experimental low-level implementation details for libc-like runtime
//! libraries such as [Origin].
//!
//! Do not use the functions in this module unless you've read all of their
//! code. They don't always behave the same way as functions with similar names
Expand All @@ -17,7 +17,7 @@
//! The API for these functions is not stable, and this module is
//! `doc(hidden)`.
//!
//! [origin]: https://github.com/sunfishcode/origin
//! [Origin]: https://github.com/sunfishcode/origin#readme
//!
//! # Safety
//!
Expand Down Expand Up @@ -273,13 +273,19 @@ pub use backend::runtime::tls::StartupTlsInfo;
/// that could cause undefined behavior. The extent to which this also
/// applies to Rust functions is unclear at this time.
///
/// - And more.
///
/// # Safety
///
/// The child must avoid accessing any memory shared with the parent in a
/// way that invokes undefined behavior. It must avoid accessing any threading
/// runtime functions in a way that invokes undefined behavior. And it must
/// avoid invoking any undefined behavior through any function that is not
/// guaranteed to be async-signal-safe.
/// guaranteed to be async-signal-safe. But, what does async-signal-safe even
/// mean in a Rust program? This documentation does not have all the answers.
///
/// So you're on your own. And on top of all the troubles with `fork` in
/// general, this wrapper implementation is highly experimental.
///
/// # References
/// - [POSIX]
Expand Down

0 comments on commit cb15bd0

Please sign in to comment.