aboutsummaryrefslogtreecommitdiff
path: root/lib/std/testing
diff options
context:
space:
mode:
authorRyan Liptak <squeek502@hotmail.com>2022-06-25 21:27:56 -0700
committerRyan Liptak <squeek502@hotmail.com>2022-06-25 21:27:56 -0700
commit22720981ea50b1cee38d8309e0cd32df401b8156 (patch)
treec2fd4b33cdaff492f4e938d2ffa0bf0fd2bcc7e2 /lib/std/testing
parent19d7f4dd8221fcd36b7fb71067bf676bb294ca1c (diff)
downloadzig-22720981ea50b1cee38d8309e0cd32df401b8156.tar.gz
zig-22720981ea50b1cee38d8309e0cd32df401b8156.zip
Move sys_can_stack_trace from GPA to std.debug so that it can be re-used as needed
Diffstat (limited to 'lib/std/testing')
-rw-r--r--lib/std/testing/failing_allocator.zig4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/std/testing/failing_allocator.zig b/lib/std/testing/failing_allocator.zig
index c5d1d3df30..03e345986b 100644
--- a/lib/std/testing/failing_allocator.zig
+++ b/lib/std/testing/failing_allocator.zig
@@ -19,9 +19,11 @@ pub const FailingAllocator = struct {
freed_bytes: usize,
allocations: usize,
deallocations: usize,
- stack_addresses: [16]usize,
+ stack_addresses: [num_stack_frames]usize,
has_induced_failure: bool,
+ const num_stack_frames = if (std.debug.sys_can_stack_trace) 16 else 0;
+
/// `fail_index` is the number of successful allocations you can
/// expect from this allocator. The next allocation will fail.
/// For example, if this is called with `fail_index` equal to 2,