Skip to content

Commit

Permalink
Unrolled build for rust-lang#132482
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#132482 - lukas-code:stab-attrs, r=Noratrieb

library: fix some stability annotations

This PR updates some stability attributes to correctly reflect when some items actually got stabilized. Found while testing rust-lang#132481.

### `core::char` / `std::char`

In rust-lang#26192, the `core::char` module got "stabilized" for 1.2.0, but the `core` crate itself was still unstable until 1.6.0.

In rust-lang#49698, the `std::char` module was changed to a re-export of `core::char`, making `std::char` appear as "stable since 1.2.0", even though it was already stable in 1.0.0.

By marking `core::char` as stable since 1.0.0, the docs will show correct versions for both `core::char` (since 1.6.0) and `std::char` (since 1.0.0). This is also consistent with the stabilities of similar re-exported modules like `core::mem`/`std::mem` for example.

### `{core,std}::array` and `{core,std}::array::TryFromSliceError`

In rust-lang#58302, the `core::array::TryFromSliceError` type got stabilized for 1.34.0, together with `TryFrom`. At that point the `core::array` module was still unstable and a `std::array` re-export didn't exist, but `core::array::TryFromSliceError` could still be named due to rust-lang#95956 to existing yet.

Then, `core::array` got stabilized and `std::array` got added, first targeting 1.36.0 in rust-lang#60657, but then getting backported for 1.35.0 in rust-lang#60838.

This means that `core::array` and `std::array` actually got stabilized in 1.35.0 and `core::array::TryFromSliceError` was accessible through the unstable module in 1.34.0 -- mark them as such so that the docs display the correct versions.
  • Loading branch information
rust-timer authored Nov 2, 2024
2 parents 588a420 + 2a6a706 commit bde2adf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions library/core/src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! *[See also the array primitive type](array).*

#![stable(feature = "core_array", since = "1.36.0")]
#![stable(feature = "core_array", since = "1.35.0")]

use crate::borrow::{Borrow, BorrowMut};
use crate::cmp::Ordering;
Expand Down Expand Up @@ -154,10 +154,11 @@ pub const fn from_mut<T>(s: &mut T) -> &mut [T; 1] {

/// The error type returned when a conversion from a slice to an array fails.
#[stable(feature = "try_from", since = "1.34.0")]
#[rustc_allowed_through_unstable_modules]
#[derive(Debug, Copy, Clone)]
pub struct TryFromSliceError(());

#[stable(feature = "core_array", since = "1.36.0")]
#[stable(feature = "core_array", since = "1.35.0")]
impl fmt::Display for TryFromSliceError {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/char/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
//! functions that convert various types to `char`.

#![allow(non_snake_case)]
#![stable(feature = "core_char", since = "1.2.0")]
#![stable(feature = "rust1", since = "1.0.0")]

mod convert;
mod decode;
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ pub mod prelude;

#[stable(feature = "rust1", since = "1.0.0")]
pub use core::any;
#[stable(feature = "core_array", since = "1.36.0")]
#[stable(feature = "core_array", since = "1.35.0")]
pub use core::array;
#[unstable(feature = "async_iterator", issue = "79024")]
pub use core::async_iter;
Expand Down

0 comments on commit bde2adf

Please sign in to comment.