Skip to content

Commit

Permalink
Rollup merge of rust-lang#135489 - RalfJung:TryFromSliceError, r=tgro…
Browse files Browse the repository at this point in the history
…ss35

remove pointless allowed_through_unstable_modules on TryFromSliceError

This got added in rust-lang#132482 but the PR does not explain why. `@lukas-code` do you still remember? Also Cc `@Noratrieb` as reviewer of that PR.

If I understand the issue description correctly, all paths under which this type is exported are stable now: `core::array::TryFromSliceError` and `std::array::TryFromSliceError`. If that is the case, we shouldn't have the attribute; it's a terrible hack that should only be used when needed to maintain backward compatibility. Getting some historic information right is IMO *not* sufficient justification to risk accidentally exposing this type via more unstable paths today or in the future.
  • Loading branch information
matthiaskrgr authored Jan 24, 2025
2 parents a7922db + 6103896 commit a3fb2a0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 0 additions & 1 deletion library/core/src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ 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(());

Expand Down
3 changes: 2 additions & 1 deletion src/doc/rustc-dev-guide/src/stability.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ Previously, due to a [rustc bug], stable items inside unstable modules were
available to stable code in that location.
As of <!-- date-check --> September 2024, items with [accidentally stabilized
paths] are marked with the `#[rustc_allowed_through_unstable_modules]` attribute
to prevent code dependent on those paths from breaking.
to prevent code dependent on those paths from breaking. Do *not* add this attribute
to any more items unless that is needed to avoid breaking changes.

The `unstable` attribute may also have the `soft` value, which makes it a
future-incompatible deny-by-default lint instead of a hard error. This is used
Expand Down

0 comments on commit a3fb2a0

Please sign in to comment.