From b5afa6807b868bc8bb2e6f972629769b150ffd41 Mon Sep 17 00:00:00 2001 From: Deadbeef Date: Sat, 14 Aug 2021 16:35:12 +0000 Subject: 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. --- library/alloc/src/vec/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'library/alloc/src/vec') diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index 933361d812c..87a0d371815 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -2758,7 +2758,8 @@ unsafe impl<#[may_dangle] T, A: Allocator> Drop for Vec { } #[stable(feature = "rust1", since = "1.0.0")] -impl Default for Vec { +#[rustc_const_unstable(feature = "const_default_impls", issue = "87864")] +impl const Default for Vec { /// Creates an empty `Vec`. fn default() -> Vec { Vec::new() -- cgit 1.4.1-3-g733a5