diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs index b3a498570f95a..a20e16af2b0a2 100644 --- a/library/core/src/array/mod.rs +++ b/library/core/src/array/mod.rs @@ -484,7 +484,7 @@ macro_rules! array_impl_default { }; {$n:expr,} => { #[stable(since = "1.4.0", feature = "array_default")] - impl Default for [T; $n] { + impl Default for [T; $n] where T: Default { fn default() -> [T; $n] { [] } } }; diff --git a/library/coretests/tests/array.rs b/library/coretests/tests/array.rs index 30ccbbc320318..2dc0e2ed3681b 100644 --- a/library/coretests/tests/array.rs +++ b/library/coretests/tests/array.rs @@ -292,13 +292,6 @@ fn array_default_impl_avoids_leaks_on_panic() { assert_eq!(COUNTER.load(Relaxed), 0); } -#[test] -fn empty_array_is_always_default() { - struct DoesNotImplDefault; - - let _arr = <[DoesNotImplDefault; 0]>::default(); -} - #[test] fn array_map() { let a = [1, 2, 3];