Skip to content

Stabilise os_str_display #137336

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
Feb 21, 2025
Merged
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
2 changes: 1 addition & 1 deletion library/std/src/ffi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,5 +201,5 @@ pub use self::c_str::{CStr, CString};
#[doc(inline)]
pub use self::os_str::{OsStr, OsString};

#[unstable(feature = "os_str_display", issue = "120048")]
#[stable(feature = "os_str_display", since = "CURRENT_RUSTC_VERSION")]
pub mod os_str;
10 changes: 4 additions & 6 deletions library/std/src/ffi/os_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1204,13 +1204,12 @@ impl OsStr {
/// # Examples
///
/// ```
/// #![feature(os_str_display)]
/// use std::ffi::OsStr;
///
/// let s = OsStr::new("Hello, world!");
/// println!("{}", s.display());
/// ```
#[unstable(feature = "os_str_display", issue = "120048")]
#[stable(feature = "os_str_display", since = "CURRENT_RUSTC_VERSION")]
#[must_use = "this does not display the `OsStr`; \
it returns an object that can be displayed"]
#[inline]
Expand Down Expand Up @@ -1559,7 +1558,6 @@ impl fmt::Debug for OsStr {
/// # Examples
///
/// ```
/// #![feature(os_str_display)]
/// use std::ffi::OsStr;
///
/// let s = OsStr::new("Hello, world!");
Expand All @@ -1568,19 +1566,19 @@ impl fmt::Debug for OsStr {
///
/// [`Display`]: fmt::Display
/// [`format!`]: crate::format
#[unstable(feature = "os_str_display", issue = "120048")]
#[stable(feature = "os_str_display", since = "CURRENT_RUSTC_VERSION")]
pub struct Display<'a> {
os_str: &'a OsStr,
}

#[unstable(feature = "os_str_display", issue = "120048")]
#[stable(feature = "os_str_display", since = "CURRENT_RUSTC_VERSION")]
impl fmt::Debug for Display<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&self.os_str, f)
}
}

#[unstable(feature = "os_str_display", issue = "120048")]
#[stable(feature = "os_str_display", since = "CURRENT_RUSTC_VERSION")]
impl fmt::Display for Display<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&self.os_str.inner, f)
Expand Down
1 change: 0 additions & 1 deletion src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#![feature(iter_intersperse)]
#![feature(let_chains)]
#![feature(never_type)]
#![feature(os_str_display)]
#![feature(round_char_boundary)]
#![feature(test)]
#![feature(type_alias_impl_trait)]
Expand Down
Loading