1
Fork 0

Rollup merge of #50945 - stjepang:stabilize-from-ref, r=SimonSapin

Stabilize feature from_ref

Function `from_ref_mut` is now renamed to `from_mut`, as discussed in #45703.

Closes #45703.

r? @SimonSapin
This commit is contained in:
kennytm 2018-05-23 00:26:17 +08:00 committed by GitHub
commit 98e801ac0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View file

@ -119,8 +119,8 @@ pub use core::slice::{SplitN, RSplitN, SplitNMut, RSplitNMut};
pub use core::slice::{RSplit, RSplitMut}; pub use core::slice::{RSplit, RSplitMut};
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub use core::slice::{from_raw_parts, from_raw_parts_mut}; pub use core::slice::{from_raw_parts, from_raw_parts_mut};
#[unstable(feature = "from_ref", issue = "45703")] #[stable(feature = "from_ref", since = "1.28.0")]
pub use core::slice::{from_ref, from_ref_mut}; pub use core::slice::{from_ref, from_mut};
#[unstable(feature = "slice_get_slice", issue = "35729")] #[unstable(feature = "slice_get_slice", issue = "35729")]
pub use core::slice::SliceIndex; pub use core::slice::SliceIndex;
#[unstable(feature = "exact_chunks", issue = "47115")] #[unstable(feature = "exact_chunks", issue = "47115")]

View file

@ -3884,7 +3884,7 @@ pub unsafe fn from_raw_parts_mut<'a, T>(data: *mut T, len: usize) -> &'a mut [T]
} }
/// Converts a reference to T into a slice of length 1 (without copying). /// Converts a reference to T into a slice of length 1 (without copying).
#[unstable(feature = "from_ref", issue = "45703")] #[stable(feature = "from_ref", since = "1.28.0")]
pub fn from_ref<T>(s: &T) -> &[T] { pub fn from_ref<T>(s: &T) -> &[T] {
unsafe { unsafe {
from_raw_parts(s, 1) from_raw_parts(s, 1)
@ -3892,8 +3892,8 @@ pub fn from_ref<T>(s: &T) -> &[T] {
} }
/// Converts a reference to T into a slice of length 1 (without copying). /// Converts a reference to T into a slice of length 1 (without copying).
#[unstable(feature = "from_ref", issue = "45703")] #[stable(feature = "from_ref", since = "1.28.0")]
pub fn from_ref_mut<T>(s: &mut T) -> &mut [T] { pub fn from_mut<T>(s: &mut T) -> &mut [T] {
unsafe { unsafe {
from_raw_parts_mut(s, 1) from_raw_parts_mut(s, 1)
} }

View file

@ -948,7 +948,7 @@ impl<'tcx> TerminatorKind<'tcx> {
Drop { target: ref mut t, unwind: Some(ref mut u), .. } | Drop { target: ref mut t, unwind: Some(ref mut u), .. } |
Assert { target: ref mut t, cleanup: Some(ref mut u), .. } | Assert { target: ref mut t, cleanup: Some(ref mut u), .. } |
FalseUnwind { real_target: ref mut t, unwind: Some(ref mut u) } => { FalseUnwind { real_target: ref mut t, unwind: Some(ref mut u) } => {
Some(t).into_iter().chain(slice::from_ref_mut(u)) Some(t).into_iter().chain(slice::from_mut(u))
} }
SwitchInt { ref mut targets, .. } => { SwitchInt { ref mut targets, .. } => {
None.into_iter().chain(&mut targets[..]) None.into_iter().chain(&mut targets[..])