Skip to content

@compileError in Allocator.zig has no stack trace #16760

@Jarred-Sumner

Description

@Jarred-Sumner

Zig Version

0.12.0-dev.41+cd7998096

Steps to Reproduce and Observed Output

code:

const std = @import("std");
test {
    var slice: []u8 = undefined;
    std.heap.page_allocator.destroy(slice);
}

error message:

/Users/jarred/zig/0.12.0-dev.41+cd7998096/files/lib/std/mem/Allocator.zig:113:28: error: ptr must be a single item pointer
    if (info.size != .One) @compileError("ptr must be a single item pointer");
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There is no stack trace

Expected Output

A stack trace showing the line which is calling .destroy instead of .free

Metadata

Metadata

Assignees

No one assigned

    Labels

    error messageThis issue points out an error message that is unhelpful and should be improved.frontendTokenization, parsing, AstGen, Sema, and Liveness.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions