Skip to content

Commit d55330c

Browse files
borsehuss
authored andcommitted
Auto merge of #96489 - shepmaster:revert-vec-from-array-ref, r=yaahc
Revert "impl From<&[T; N]> and From<&mut [T; N]> for Vec<T>" This reverts commit 5dd7027.
1 parent b802d2d commit d55330c

File tree

1 file changed

+0
-42
lines changed

1 file changed

+0
-42
lines changed

library/alloc/src/vec/mod.rs

-42
Original file line numberDiff line numberDiff line change
@@ -2931,48 +2931,6 @@ impl<T, const N: usize> From<[T; N]> for Vec<T> {
29312931
}
29322932
}
29332933

2934-
#[cfg(not(no_global_oom_handling))]
2935-
#[stable(feature = "vec_from_array_ref", since = "1.61.0")]
2936-
impl<T: Clone, const N: usize> From<&[T; N]> for Vec<T> {
2937-
/// Allocate a `Vec<T>` and fill it by cloning `s`'s items.
2938-
///
2939-
/// # Examples
2940-
///
2941-
/// ```
2942-
/// assert_eq!(Vec::from(b"raw"), vec![b'r', b'a', b'w']);
2943-
/// ```
2944-
#[cfg(not(test))]
2945-
fn from(s: &[T; N]) -> Vec<T> {
2946-
s.to_vec()
2947-
}
2948-
2949-
#[cfg(test)]
2950-
fn from(s: &[T; N]) -> Vec<T> {
2951-
crate::slice::to_vec(s, Global)
2952-
}
2953-
}
2954-
2955-
#[cfg(not(no_global_oom_handling))]
2956-
#[stable(feature = "vec_from_array_ref", since = "1.61.0")]
2957-
impl<T: Clone, const N: usize> From<&mut [T; N]> for Vec<T> {
2958-
/// Allocate a `Vec<T>` and fill it by cloning `s`'s items.
2959-
///
2960-
/// # Examples
2961-
///
2962-
/// ```
2963-
/// assert_eq!(Vec::from(&mut [1, 2, 3]), vec![1, 2, 3]);
2964-
/// ```
2965-
#[cfg(not(test))]
2966-
fn from(s: &mut [T; N]) -> Vec<T> {
2967-
s.to_vec()
2968-
}
2969-
2970-
#[cfg(test)]
2971-
fn from(s: &mut [T; N]) -> Vec<T> {
2972-
crate::slice::to_vec(s, Global)
2973-
}
2974-
}
2975-
29762934
#[stable(feature = "vec_from_cow_slice", since = "1.14.0")]
29772935
impl<'a, T> From<Cow<'a, [T]>> for Vec<T>
29782936
where

0 commit comments

Comments
 (0)