about summary refs log tree commit diff
path: root/library/core/src/array
diff options
context:
space:
mode:
authorDeadbeef <ent3rm4n@gmail.com>2021-08-14 16:35:12 +0000
committerDeadbeef <ent3rm4n@gmail.com>2021-08-17 07:15:54 +0000
commitb5afa6807b868bc8bb2e6f972629769b150ffd41 (patch)
tree4abfdf049ab0964aa14b4137fe4446d019169939 /library/core/src/array
parent3b5df014390dcef66cc35f968fe51e9558e6ca13 (diff)
downloadrust-b5afa6807b868bc8bb2e6f972629769b150ffd41.tar.gz
rust-b5afa6807b868bc8bb2e6f972629769b150ffd41.zip
Constified `Default` implementations
The libs-api team agrees to allow const_trait_impl to appear in the
standard library as long as stable code cannot be broken (they are
properly gated) this means if the compiler teams thinks it's okay, then
it's okay.

My priority on constifying would be:

	1. Non-generic impls (e.g. Default) or generic impls with no
	   bounds
	2. Generic functions with bounds (that use const impls)
	3. Generic impls with bounds
	4. Impls for traits with associated types

For people opening constification PRs: please cc me and/or oli-obk.
Diffstat (limited to 'library/core/src/array')
-rw-r--r--library/core/src/array/mod.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs
index 3bc9f71375c..3c638e655dc 100644
--- a/library/core/src/array/mod.rs
+++ b/library/core/src/array/mod.rs
@@ -280,7 +280,8 @@ macro_rules! array_impl_default {
     };
     {$n:expr,} => {
         #[stable(since = "1.4.0", feature = "array_default")]
-        impl<T> Default for [T; $n] {
+        #[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
+        impl<T> const Default for [T; $n] {
             fn default() -> [T; $n] { [] }
         }
     };