mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 23:31:12 +00:00
Acknowledge possibility of roc_alloc failing
This commit is contained in:
parent
9b05d8dd50
commit
778d32f6b2
4 changed files with 20 additions and 11 deletions
|
@ -101,7 +101,8 @@ pub fn getExpectFailures() []Failure {
|
|||
|
||||
// defensively clone failures, in case someone modifies the originals after the mutex has been released.
|
||||
const num_bytes = failure_length * @sizeOf(Failure);
|
||||
const raw_clones = utils.alloc(num_bytes, @alignOf(Failure));
|
||||
// TODO handle the possibility of alloc failing
|
||||
const raw_clones = utils.alloc(num_bytes, @alignOf(Failure)) orelse unreachable;
|
||||
const clones = @ptrCast([*]Failure, @alignCast(@alignOf(Failure), raw_clones));
|
||||
|
||||
utils.memcpy(@ptrCast([*]u8, clones), @ptrCast([*]u8, raw_clones), num_bytes);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue