Skip to content

Clarify doc comment on unix OpenOptions #142889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 29, 2025
Merged
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
12 changes: 5 additions & 7 deletions library/std/src/os/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,24 +408,22 @@ pub trait OpenOptionsExt {
/// Pass custom flags to the `flags` argument of `open`.
///
/// The bits that define the access mode are masked out with `O_ACCMODE`, to
/// ensure they do not interfere with the access mode set by Rusts options.
/// ensure they do not interfere with the access mode set by Rust's options.
///
/// Custom flags can only set flags, not remove flags set by Rusts options.
/// This options overwrites any previously set custom flags.
/// Custom flags can only set flags, not remove flags set by Rust's options.
/// This function overwrites any previously-set custom flags.
///
/// # Examples
///
/// ```no_run
/// # #![feature(rustc_private)]
/// # mod libc { pub const O_NOFOLLOW: i32 = 0; }
/// use std::fs::OpenOptions;
/// use std::os::unix::fs::OpenOptionsExt;
///
/// # fn main() {
/// let mut options = OpenOptions::new();
/// options.write(true);
/// if cfg!(unix) {
/// options.custom_flags(libc::O_NOFOLLOW);
/// }
/// options.custom_flags(libc::O_NOFOLLOW);
/// let file = options.open("foo.txt");
/// # }
/// ```
Expand Down
Loading