Skip to content

Commit a2105b8

Browse files
committed
make RawVec::empty const
1 parent 256096d commit a2105b8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/liballoc/raw_vec.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ pub struct RawVec<T, A: Alloc = Global> {
5454
}
5555

5656
impl<T, A: Alloc> RawVec<T, A> {
57+
// FIXME: this should be made `const` when `if` statements are allowed
5758
/// Like `new` but parameterized over the choice of allocator for
5859
/// the returned RawVec.
5960
pub fn new_in(a: A) -> Self {
@@ -68,6 +69,7 @@ impl<T, A: Alloc> RawVec<T, A> {
6869
}
6970
}
7071

72+
// FIXME: this should removed when `new_in` can be made `const`
7173
/// Like `empty` but parametrized over the choice of allocator for the returned `RawVec`.
7274
pub const fn empty_in(a: A) -> Self {
7375
// Unique::empty() doubles as "unallocated" and "zero-sized allocation"
@@ -134,9 +136,10 @@ impl<T> RawVec<T, Global> {
134136
Self::new_in(Global)
135137
}
136138

139+
// FIXME: this should removed when `new` can be made `const`
137140
/// Create a `RawVec` with capcity 0 (on the system heap), regardless of `T`, without
138141
/// allocating.
139-
pub fn empty() -> Self {
142+
pub const fn empty() -> Self {
140143
Self::empty_in(Global)
141144
}
142145

0 commit comments

Comments
 (0)