about summary refs log tree commit diff
path: root/library/core/src
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-04-25 01:53:10 +0900
committerGitHub <noreply@github.com>2021-04-25 01:53:10 +0900
commit46b67ab0f957fca36baf3ef1a37be593d15063ed (patch)
tree919075e3927730464fecf9d5282c4627f9eab3e9 /library/core/src
parente109aa3613f89bd0a440a9a947c405dcfcc0dc28 (diff)
parent740b0529fb23a69855447a9916bbb41d34918460 (diff)
downloadrust-46b67ab0f957fca36baf3ef1a37be593d15063ed.tar.gz
rust-46b67ab0f957fca36baf3ef1a37be593d15063ed.zip
Rollup merge of #84105 - WaffleLapkin:stabilize_array_from_ref, r=m-ou-se
stabilize `core::array::{from_ref,from_mut}` in `1.53.0`

I didn't get any response in https://github.com/rust-lang/rust/issues/77101#issuecomment-761831104, so I figured out I can try opening stabilization pr.

---

This PR stabilizes following functions:
```rust
// core::array
pub fn from_ref<T>(s: &T) -> &[T; 1];
pub fn from_mut<T>(s: &mut T) -> &mut [T; 1];
```

Functions are similar to already stabilized `core::slice::{`[`from_ref`](https://doc.rust-lang.org/std/slice/fn.from_ref.html),[`from_mut`](https://doc.rust-lang.org/std/slice/fn.from_mut.html)`}` and were unstable without any problems/questions for a while now.

---

resolves #77101

``@rustbot`` modify labels: +T-libs
Diffstat (limited to 'library/core/src')
-rw-r--r--library/core/src/array/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs
index b6ce825e247..5c7a8bdf6bd 100644
--- a/library/core/src/array/mod.rs
+++ b/library/core/src/array/mod.rs
@@ -22,14 +22,14 @@ mod iter;
 pub use iter::IntoIter;
 
 /// Converts a reference to `T` into a reference to an array of length 1 (without copying).
-#[unstable(feature = "array_from_ref", issue = "77101")]
+#[stable(feature = "array_from_ref", since = "1.53.0")]
 pub fn from_ref<T>(s: &T) -> &[T; 1] {
     // SAFETY: Converting `&T` to `&[T; 1]` is sound.
     unsafe { &*(s as *const T).cast::<[T; 1]>() }
 }
 
 /// Converts a mutable reference to `T` into a mutable reference to an array of length 1 (without copying).
-#[unstable(feature = "array_from_ref", issue = "77101")]
+#[stable(feature = "array_from_ref", since = "1.53.0")]
 pub fn from_mut<T>(s: &mut T) -> &mut [T; 1] {
     // SAFETY: Converting `&mut T` to `&mut [T; 1]` is sound.
     unsafe { &mut *(s as *mut T).cast::<[T; 1]>() }