diff options
| author | kennytm <kennytm@gmail.com> | 2018-05-01 01:18:36 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-01 01:18:36 +0800 |
| commit | b88c152784f36825a2a75b062db6cc55ff02297f (patch) | |
| tree | d46a6974a13307856ecbbfd711ac1be5c3032893 /src/liballoc/vec.rs | |
| parent | 64e6dda0bce96da47e52f7f3e278d05f7a09473c (diff) | |
| parent | f9f992379de4a82637ec4bf717ff42f27872bc48 (diff) | |
Rollup merge of #50233 - mark-i-m:const_vec, r=kennytm
Make `Vec::new` a `const fn`
`RawVec::empty/_in` are a hack. They're there because `if size_of::<T> == 0 { !0 } else { 0 }` is not allowed in `const` yet. However, because `RawVec` is unstable, the `empty/empty_in` constructors can be removed when #49146 is done...
Diffstat (limited to 'src/liballoc/vec.rs')
| -rw-r--r-- | src/liballoc/vec.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index b184404c15b..35d0a69a05a 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -322,7 +322,8 @@ impl<T> Vec<T> { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - pub fn new() -> Vec<T> { + #[rustc_const_unstable(feature = "const_vec_new")] + pub const fn new() -> Vec<T> { Vec { buf: RawVec::new(), len: 0, |
