Skip to content

Commit 4950bf5

Browse files
authored
Rollup merge of #146533 - Zalathar:array-default, r=compiler-errors
Note some previous attempts to change the Default impl for `[T; 0]` Recently, #145457 experimented with changing the Default impl for `[T; 0]`. Subsequently, #146531 also aimed to perform a similar experiment. It seems like a good idea to add some links to the relevant source code, so that the historical context of this tricky topic is easier to find.
2 parents f34e30a + 16c7206 commit 4950bf5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

library/core/src/array/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,11 @@ impl<T: Copy> SpecArrayClone for T {
472472
// The Default impls cannot be done with const generics because `[T; 0]` doesn't
473473
// require Default to be implemented, and having different impl blocks for
474474
// different numbers isn't supported yet.
475+
//
476+
// Trying to improve the `[T; 0]` situation has proven to be difficult.
477+
// Please see these issues for more context on past attempts and crater runs:
478+
// - https://github.com/rust-lang/rust/issues/61415
479+
// - https://github.com/rust-lang/rust/pull/145457
475480

476481
macro_rules! array_impl_default {
477482
{$n:expr, $t:ident $($ts:ident)*} => {

0 commit comments

Comments
 (0)