Skip to content

Commit fc9d5c0

Browse files
committed
fix(core,kernel): add ~const to the Destruct trait bounds of ComptimeVec
This is likely the effect of [rust-lang/rust#103351][1]. [1]: rust-lang/rust#103351
1 parent 3067a04 commit fc9d5c0

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/r3_core/src/utils/binary_heap/veclike.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use arrayvec::ArrayVec;
2-
use core::ops;
2+
use core::{marker::Destruct, ops};
33

44
#[const_trait]
55
pub trait VecLike:
@@ -12,7 +12,7 @@ pub trait VecLike:
1212
fn push(&mut self, x: Self::Element);
1313
}
1414

15-
impl<T, const N: usize> VecLike for ArrayVec<T, N> {
15+
impl<T: ~const Destruct, const N: usize> VecLike for ArrayVec<T, N> {
1616
type Element = T;
1717
fn is_empty(&self) -> bool {
1818
self.is_empty()
@@ -28,7 +28,7 @@ impl<T, const N: usize> VecLike for ArrayVec<T, N> {
2828
}
2929
}
3030

31-
impl<T> const VecLike for crate::utils::ComptimeVec<T> {
31+
impl<T: ~const Destruct> const VecLike for crate::utils::ComptimeVec<T> {
3232
type Element = T;
3333
fn is_empty(&self) -> bool {
3434
(**self).is_empty()

src/r3_core/src/utils/vec.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use super::{AllocError, Allocator, ConstAllocator};
44

55
/// `Vec` that can only be used in a constant context.
66
#[doc(hidden)]
7-
pub struct ComptimeVec<T: Destruct> {
7+
pub struct ComptimeVec<T: ~const Destruct> {
88
ptr: NonNull<T>,
99
len: usize,
1010
capacity: usize,
@@ -39,7 +39,7 @@ impl<T: ~const Destruct> const Drop for ComptimeVec<T> {
3939
}
4040
}
4141

42-
impl<T> ComptimeVec<T> {
42+
impl<T: ~const Destruct> ComptimeVec<T> {
4343
pub const fn new_in(allocator: ConstAllocator) -> Self {
4444
Self::with_capacity_in(0, allocator)
4545
}
@@ -114,7 +114,7 @@ impl<T> ComptimeVec<T> {
114114

115115
/// Return a `ComptimeVec` of the same `len` as `self` with function `f`
116116
/// applied to each element in order.
117-
pub const fn map<F: ~const FnMut(&T) -> U + ~const Destruct, U>(
117+
pub const fn map<F: ~const FnMut(&T) -> U + ~const Destruct, U: ~const Destruct>(
118118
&self,
119119
mut f: F,
120120
) -> ComptimeVec<U> {
@@ -165,15 +165,15 @@ impl<T> ComptimeVec<T> {
165165
}
166166
}
167167

168-
impl<T> const ops::Deref for ComptimeVec<T> {
168+
impl<T: ~const Destruct> const ops::Deref for ComptimeVec<T> {
169169
type Target = [T];
170170

171171
fn deref(&self) -> &Self::Target {
172172
self.as_slice()
173173
}
174174
}
175175

176-
impl<T> const ops::DerefMut for ComptimeVec<T> {
176+
impl<T: ~const Destruct> const ops::DerefMut for ComptimeVec<T> {
177177
fn deref_mut(&mut self) -> &mut Self::Target {
178178
self.as_mut_slice()
179179
}

0 commit comments

Comments
 (0)