diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs index acb18e6d064e6..59dfd9f9dc424 100644 --- a/library/std/src/sys/unix/fs.rs +++ b/library/std/src/sys/unix/fs.rs @@ -692,6 +692,7 @@ impl OpenOptions { } } + impl File { pub fn open(path: &Path, opts: &OpenOptions) -> io::Result { let path = cstr(path)?; @@ -962,6 +963,12 @@ pub fn rename(old: &Path, new: &Path) -> io::Result<()> { Ok(()) } +pub fn get_openopetions_as_cint(from: OpenOptions) -> io::Result { + let access_mode = from.get_access_mode()?; + let creation_mode = from.get_creation_mode()?; + Ok(creation_mode | access_mode) +} + pub fn set_perm(p: &Path, perm: FilePermissions) -> io::Result<()> { let p = cstr(p)?; cvt_r(|| unsafe { libc::chmod(p.as_ptr(), perm.mode) })?; diff --git a/src/doc/unstable-book/src/language-features/const-fn.md b/src/doc/unstable-book/src/language-features/const-fn.md deleted file mode 100644 index 50dbbaf56743c..0000000000000 --- a/src/doc/unstable-book/src/language-features/const-fn.md +++ /dev/null @@ -1,29 +0,0 @@ -# `const_fn` - -The tracking issue for this feature is: [#57563] - -[#57563]: https://github.com/rust-lang/rust/issues/57563 - ------------------------- - -The `const_fn` feature allows marking free functions and inherent methods as -`const`, enabling them to be called in constants contexts, with constant -arguments. - -## Examples - -```rust -#![feature(const_fn)] - -const fn double(x: i32) -> i32 { - x * 2 -} - -const FIVE: i32 = 5; -const TEN: i32 = double(FIVE); - -fn main() { - assert_eq!(5, FIVE); - assert_eq!(10, TEN); -} -```