diff options
| author | Mark Mansi <markm@cs.wisc.edu> | 2018-04-25 16:42:57 -0500 |
|---|---|---|
| committer | Mark Mansi <markm@cs.wisc.edu> | 2018-04-25 16:42:57 -0500 |
| commit | a2105b8e21a71f513e6840ec0571cad5c1a36012 (patch) | |
| tree | 525e93f087997576b0b359150bc3dbf22c083ebb /src/liballoc | |
| parent | 256096da9ee680366b839f912e8d3ecccc0da033 (diff) | |
| download | rust-a2105b8e21a71f513e6840ec0571cad5c1a36012.tar.gz rust-a2105b8e21a71f513e6840ec0571cad5c1a36012.zip | |
make RawVec::empty const
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/raw_vec.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs index dc8ad9ee061..fe18979fb51 100644 --- a/src/liballoc/raw_vec.rs +++ b/src/liballoc/raw_vec.rs @@ -54,6 +54,7 @@ pub struct RawVec<T, A: Alloc = Global> { } impl<T, A: Alloc> RawVec<T, A> { + // FIXME: this should be made `const` when `if` statements are allowed /// Like `new` but parameterized over the choice of allocator for /// the returned RawVec. pub fn new_in(a: A) -> Self { @@ -68,6 +69,7 @@ impl<T, A: Alloc> RawVec<T, A> { } } + // FIXME: this should removed when `new_in` can be made `const` /// Like `empty` but parametrized over the choice of allocator for the returned `RawVec`. pub const fn empty_in(a: A) -> Self { // Unique::empty() doubles as "unallocated" and "zero-sized allocation" @@ -134,9 +136,10 @@ impl<T> RawVec<T, Global> { Self::new_in(Global) } + // FIXME: this should removed when `new` can be made `const` /// Create a `RawVec` with capcity 0 (on the system heap), regardless of `T`, without /// allocating. - pub fn empty() -> Self { + pub const fn empty() -> Self { Self::empty_in(Global) } |
