Rollup merge of #119153 - rursprung:stabilize-file_create_new, r=dtolnay

stabilize `file_create_new`

closes #105135
This commit is contained in:
Matthias Krüger 2023-12-23 20:02:28 +01:00 committed by GitHub
commit b136919ca6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -411,8 +411,6 @@ impl File {
/// # Examples
///
/// ```no_run
/// #![feature(file_create_new)]
///
/// use std::fs::File;
/// use std::io::Write;
///
@ -422,7 +420,7 @@ impl File {
/// Ok(())
/// }
/// ```
#[unstable(feature = "file_create_new", issue = "105135")]
#[stable(feature = "file_create_new", since = "CURRENT_RUSTC_VERSION")]
pub fn create_new<P: AsRef<Path>>(path: P) -> io::Result<File> {
OpenOptions::new().read(true).write(true).create_new(true).open(path.as_ref())
}