You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
std.heap.DebugAllocator with .safety = true broken on freestanding targets #25978
fn nullAllocator() std.mem.Allocator {
return .{ .ptr = undefined, .vtable = undefined };
}
pub const os = struct {
pub const heap = struct {
// NEVER USE THIS! This is just to stop it from defaulting fields to POSIX page allocator
// DebugAllocator should have its .backing_allocator explicitly set to something else.
pub const page_allocator = nullAllocator();
};
};
Yields:
std\posix.zig:3270:18: error: struct 'posix.system__struct_2784' has no member named 'isatty'
return system.isatty(handle) != 0;
~~~~~~^~~~~~~
std\posix.zig:49:13: note: struct declared here
else => struct {
^~~~~~
referenced by:
isTty: std\fs\File.zig:130:24
supportsAnsiEscapeCodes: std\fs\File.zig:242:19
getOrEnableAnsiEscapeSupport: std\fs\File.zig:220:40
detect: std\Io\tty.zig:58:46
detectConfig: std\Io\tty.zig:10:19
free: std\heap\debug_allocator.zig:938:67
allocator: std\heap\debug_allocator.zig:344:22
Setting .safety to false makes it compile, it seems to me that the only issue are these calls to detectConfig to find out if we can use ANSI colour codes or not.
Expected Behavior
Somewhere in that call stack has a root.os escape hatch, so I can define my own supportsAnsiEscapeCodes function, or somewhere higher up, I'm not sure.
Activity
docs(safety): say what each detector cannot see, and refresh the Zig …