Const strings and bytes were not properly converted to compile time bools.

Contracts @require/@ensure are no longer treated as conditionals, but must be explicitly bool.
This commit is contained in:
Christoffer Lerno
2025-01-18 23:24:55 +01:00
parent 5a36f0bc16
commit c3f5806aa3
13 changed files with 29 additions and 27 deletions

View File

@@ -61,8 +61,8 @@ struct DynamicArenaChunk @local
}
<*
@require ptr
@require self.page `tried to free pointer on invalid allocator`
@require ptr != null
@require self.page != null `tried to free pointer on invalid allocator`
*>
fn void DynamicArenaAllocator.release(&self, void* ptr, bool) @dynamic
{
@@ -77,7 +77,7 @@ fn void DynamicArenaAllocator.release(&self, void* ptr, bool) @dynamic
<*
@require size > 0 `Resize doesn't support zeroing`
@require old_pointer != null `Resize doesn't handle null pointers`
@require self.page `tried to realloc pointer on invalid allocator`
@require self.page != null `tried to realloc pointer on invalid allocator`
*>
fn void*! DynamicArenaAllocator.resize(&self, void* old_pointer, usz size, usz alignment) @dynamic
{

View File

@@ -12,7 +12,7 @@ struct SimpleHeapAllocator (Allocator)
}
<*
@require allocator "An underlying memory provider must be given"
@require allocator != null "An underlying memory provider must be given"
@require !self.free_list "The allocator may not be already initialized"
*>
fn void SimpleHeapAllocator.init(&self, MemoryAllocFn allocator)

View File

@@ -56,7 +56,7 @@ struct OnStackAllocatorHeader
}
<*
@require old_pointer
@require old_pointer != null
*>
fn void OnStackAllocator.release(&self, void* old_pointer, bool aligned) @dynamic
{