File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
src/r3_core/src/utils/alloc Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -394,6 +394,8 @@ unsafe impl const rlsf::FlexSource for ConstFlexSource {
394
394
return None ;
395
395
} ;
396
396
397
+ assert ! ( min_size != 0 ) ;
398
+
397
399
// FIXME: Directly calling `const_allocate` from here causes the
398
400
// compiler to panic
399
401
// Safety: `const_allocate_{in_const, at_rt}` behave observably
Original file line number Diff line number Diff line change @@ -47,6 +47,11 @@ impl<T: Copy> Frozen<T> {
47
47
. checked_mul ( x. len ( ) )
48
48
. expect ( "size overflow" ) ;
49
49
let align = core:: mem:: align_of :: < T > ( ) ;
50
+
51
+ if size == 0 {
52
+ return & [ ] ;
53
+ }
54
+
50
55
unsafe {
51
56
// Allocate a CTFE heap memory block
52
57
let ptr = core:: intrinsics:: const_allocate ( size, align) . cast :: < T > ( ) ;
You can’t perform that action at this time.
0 commit comments