From 4183c6f1a52959ab5eef540c8eec1758079554eb Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 23 Dec 2017 22:08:53 -0500 Subject: [PATCH] move std/debug.zig to a subdirectory self hosted compiler parser tests do some fuzz testing --- CMakeLists.txt | 3 +- build.zig | 3 +- src-self-hosted/parser.zig | 30 ++++++---- std/array_list.zig | 5 +- std/base64.zig | 5 +- std/buffer.zig | 9 +-- std/cstr.zig | 5 +- std/debug/failing_allocator.zig | 64 +++++++++++++++++++++ std/{debug.zig => debug/index.zig} | 62 +------------------- std/fmt/errol/index.zig | 7 ++- std/fmt/index.zig | 7 ++- std/hash_map.zig | 7 ++- std/heap.zig | 9 +-- std/index.zig | 4 +- std/linked_list.zig | 5 +- std/math/acos.zig | 5 +- std/math/acosh.zig | 5 +- std/math/asin.zig | 5 +- std/math/asinh.zig | 5 +- std/math/atan.zig | 5 +- std/math/atan2.zig | 5 +- std/math/atanh.zig | 5 +- std/math/cbrt.zig | 5 +- std/math/ceil.zig | 5 +- std/math/copysign.zig | 5 +- std/math/cos.zig | 5 +- std/math/cosh.zig | 5 +- std/math/exp.zig | 5 +- std/math/exp2.zig | 5 +- std/math/expm1.zig | 5 +- std/math/fabs.zig | 5 +- std/math/floor.zig | 5 +- std/math/fma.zig | 5 +- std/math/frexp.zig | 5 +- std/math/hypot.zig | 5 +- std/math/ilogb.zig | 5 +- std/math/index.zig | 3 +- std/math/inf.zig | 5 +- std/math/isfinite.zig | 5 +- std/math/isinf.zig | 5 +- std/math/isnan.zig | 5 +- std/math/isnormal.zig | 5 +- std/math/ln.zig | 5 +- std/math/log.zig | 5 +- std/math/log10.zig | 5 +- std/math/log1p.zig | 5 +- std/math/log2.zig | 5 +- std/math/modf.zig | 5 +- std/math/pow.zig | 5 +- std/math/round.zig | 5 +- std/math/scalbn.zig | 5 +- std/math/signbit.zig | 5 +- std/math/sin.zig | 5 +- std/math/sinh.zig | 5 +- std/math/sqrt.zig | 5 +- std/math/tan.zig | 5 +- std/math/tanh.zig | 5 +- std/math/trunc.zig | 5 +- std/mem.zig | 5 +- std/net.zig | 7 ++- std/os/darwin.zig | 5 +- std/os/index.zig | 21 +++---- std/os/linux.zig | 3 +- std/os/path.zig | 14 ++--- std/rand.zig | 7 ++- std/special/compiler_rt/fixunsdfdi_test.zig | 2 +- std/special/compiler_rt/fixunsdfsi_test.zig | 2 +- std/special/compiler_rt/fixunsdfti_test.zig | 2 +- std/special/compiler_rt/fixunssfdi_test.zig | 2 +- std/special/compiler_rt/fixunssfsi_test.zig | 2 +- std/special/compiler_rt/fixunssfti_test.zig | 2 +- std/special/compiler_rt/fixunstfdi_test.zig | 2 +- std/special/compiler_rt/fixunstfsi_test.zig | 2 +- std/special/compiler_rt/fixunstfti_test.zig | 2 +- std/special/compiler_rt/index.zig | 2 +- 75 files changed, 297 insertions(+), 223 deletions(-) create mode 100644 std/debug/failing_allocator.zig rename std/{debug.zig => debug/index.zig} (94%) diff --git a/CMakeLists.txt b/CMakeLists.txt index d8e2d9ff7a199d08f704d3a66f070279e9f3335b..b94b4e132356cb69d3afe83f600bef75ef4a456f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -516,7 +516,8 @@ install(FILES "${CMAKE_SOURCE_DIR}/std/c/index.zig" DESTINATION "${ZIG_STD_DEST} install(FILES "${CMAKE_SOURCE_DIR}/std/c/linux.zig" DESTINATION "${ZIG_STD_DEST}/c") install(FILES "${CMAKE_SOURCE_DIR}/std/c/windows.zig" DESTINATION "${ZIG_STD_DEST}/c") install(FILES "${CMAKE_SOURCE_DIR}/std/cstr.zig" DESTINATION "${ZIG_STD_DEST}") -install(FILES "${CMAKE_SOURCE_DIR}/std/debug.zig" DESTINATION "${ZIG_STD_DEST}") +install(FILES "${CMAKE_SOURCE_DIR}/std/debug/index.zig" DESTINATION "${ZIG_STD_DEST}/debug") +install(FILES "${CMAKE_SOURCE_DIR}/std/debug/failing_allocator.zig" DESTINATION "${ZIG_STD_DEST}/debug") install(FILES "${CMAKE_SOURCE_DIR}/std/dwarf.zig" DESTINATION "${ZIG_STD_DEST}") install(FILES "${CMAKE_SOURCE_DIR}/std/elf.zig" DESTINATION "${ZIG_STD_DEST}") install(FILES "${CMAKE_SOURCE_DIR}/std/empty.zig" DESTINATION "${ZIG_STD_DEST}") diff --git a/build.zig b/build.zig index dbb54f8c3e6d12d9b2c50705c62cb319e467c2f9..e6564db96ec620cfb194d8f9c68d3f6674986056 100644 --- a/build.zig +++ b/build.zig @@ -172,7 +172,8 @@ pub fn installStdLib(b: &Builder) { "c/linux.zig", "c/windows.zig", "cstr.zig", - "debug.zig", + "debug/failing_allocator.zig", + "debug/index.zig", "dwarf.zig", "elf.zig", "empty.zig", diff --git a/src-self-hosted/parser.zig b/src-self-hosted/parser.zig index c997536ce2df5267e9316f07029dc5ffbaec4338..faba8e6059c7dab26d383ba943ba484f9c3cd9f6 100644 --- a/src-self-hosted/parser.zig +++ b/src-self-hosted/parser.zig @@ -1119,18 +1119,24 @@ fn testCanonical(source: []const u8) { break :x failing_allocator.index; }; - // TODO make this pass - //var fail_index = needed_alloc_count; - //while (fail_index != 0) { - // fail_index -= 1; - // var fixed_allocator = mem.FixedBufferAllocator.init(fixed_buffer_mem[0..]); - // var failing_allocator = std.debug.FailingAllocator.init(&fixed_allocator.allocator, fail_index); - // if (testParse(source, &failing_allocator.allocator)) |_| { - // @panic("non-deterministic memory usage"); - // } else |err| { - // assert(err == error.OutOfMemory); - // } - //} + var fail_index: usize = 0; + while (fail_index < needed_alloc_count) : (fail_index += 1) { + var fixed_allocator = mem.FixedBufferAllocator.init(fixed_buffer_mem[0..]); + var failing_allocator = std.debug.FailingAllocator.init(&fixed_allocator.allocator, fail_index); + if (testParse(source, &failing_allocator.allocator)) |_| { + @panic("non-deterministic memory usage"); + } else |err| { + assert(err == error.OutOfMemory); + // TODO make this pass + //if (failing_allocator.allocated_bytes != failing_allocator.freed_bytes) { + // warn("\nfail_index: {}/{}\nallocated bytes: {}\nfreed bytes: {}\nallocations: {}\ndeallocations: {}\n", + // fail_index, needed_alloc_count, + // failing_allocator.allocated_bytes, failing_allocator.freed_bytes, + // failing_allocator.index, failing_allocator.deallocations); + // @panic("memory leak detected"); + //} + } + } } test "zig fmt" { diff --git a/std/array_list.zig b/std/array_list.zig index 04db4dd280121b23e25db76a11fb4308cae93bd3..db5581dc08b7fa21fac2e0007efe09b2ac05d0cc 100644 --- a/std/array_list.zig +++ b/std/array_list.zig @@ -1,6 +1,7 @@ -const debug = @import("debug.zig"); +const std = @import("index.zig"); +const debug = std.debug; const assert = debug.assert; -const mem = @import("mem.zig"); +const mem = std.mem; const Allocator = mem.Allocator; pub fn ArrayList(comptime T: type) -> type { diff --git a/std/base64.zig b/std/base64.zig index 840643b565b454f72e1ae9abf7527598df2818fa..0b405b1f4cd72ae5ef83b931ff25bf2069e1779c 100644 --- a/std/base64.zig +++ b/std/base64.zig @@ -1,5 +1,6 @@ -const assert = @import("debug.zig").assert; -const mem = @import("mem.zig"); +const std = @import("index.zig"); +const assert = std.debug.assert; +const mem = std.mem; pub const standard_alphabet_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; pub const standard_pad_char = '='; diff --git a/std/buffer.zig b/std/buffer.zig index 4f5d281f4898eddf8237c5adc1e1436728545450..2bb395d0fb2a93e9df314f82c71cfd482d36b888 100644 --- a/std/buffer.zig +++ b/std/buffer.zig @@ -1,10 +1,11 @@ -const debug = @import("debug.zig"); -const mem = @import("mem.zig"); +const std = @import("index.zig"); +const debug = std.debug; +const mem = std.mem; const Allocator = mem.Allocator; const assert = debug.assert; -const ArrayList = @import("array_list.zig").ArrayList; +const ArrayList = std.ArrayList; -const fmt = @import("fmt/index.zig"); +const fmt = std.fmt; /// A buffer that allocates memory and maintains a null byte at the end. pub const Buffer = struct { diff --git a/std/cstr.zig b/std/cstr.zig index 445f7ab89234f90a77af112811dbe6e404afcebd..d17b69c7a182bb155c9ff2701b8369ff9b8bcf1b 100644 --- a/std/cstr.zig +++ b/std/cstr.zig @@ -1,5 +1,6 @@ -const debug = @import("debug.zig"); -const mem = @import("mem.zig"); +const std = @import("index.zig"); +const debug = std.debug; +const mem = std.mem; const assert = debug.assert; pub fn len(ptr: &const u8) -> usize { diff --git a/std/debug/failing_allocator.zig b/std/debug/failing_allocator.zig new file mode 100644 index 0000000000000000000000000000000000000000..9b12ff5cb7e499acb8093490a02b1d979cc687bf --- /dev/null +++ b/std/debug/failing_allocator.zig @@ -0,0 +1,64 @@ +const std = @import("../index.zig"); +const mem = std.mem; + +/// Allocator that fails after N allocations, useful for making sure out of +/// memory conditions are handled correctly. +pub const FailingAllocator = struct { + allocator: mem.Allocator, + index: usize, + fail_index: usize, + internal_allocator: &mem.Allocator, + allocated_bytes: usize, + freed_bytes: usize, + deallocations: usize, + + pub fn init(allocator: &mem.Allocator, fail_index: usize) -> FailingAllocator { + return FailingAllocator { + .internal_allocator = allocator, + .fail_index = fail_index, + .index = 0, + .allocated_bytes = 0, + .freed_bytes = 0, + .deallocations = 0, + .allocator = mem.Allocator { + .allocFn = alloc, + .reallocFn = realloc, + .freeFn = free, + }, + }; + } + + fn alloc(allocator: &mem.Allocator, n: usize, alignment: u29) -> %[]u8 { + const self = @fieldParentPtr(FailingAllocator, "allocator", allocator); + if (self.index == self.fail_index) { + return error.OutOfMemory; + } + const result = %return self.internal_allocator.allocFn(self.internal_allocator, n, alignment); + self.allocated_bytes += result.len; + self.index += 1; + return result; + } + + fn realloc(allocator: &mem.Allocator, old_mem: []u8, new_size: usize, alignment: u29) -> %[]u8 { + const self = @fieldParentPtr(FailingAllocator, "allocator", allocator); + if (new_size <= old_mem.len) { + self.freed_bytes += old_mem.len - new_size; + return self.internal_allocator.reallocFn(self.internal_allocator, old_mem, new_size, alignment); + } + if (self.index == self.fail_index) { + return error.OutOfMemory; + } + const result = %return self.internal_allocator.reallocFn(self.internal_allocator, old_mem, new_size, alignment); + self.allocated_bytes += new_size - old_mem.len; + self.deallocations += 1; + self.index += 1; + return result; + } + + fn free(allocator: &mem.Allocator, bytes: []u8) { + const self = @fieldParentPtr(FailingAllocator, "allocator", allocator); + self.freed_bytes += bytes.len; + self.deallocations += 1; + return self.internal_allocator.freeFn(self.internal_allocator, bytes); + } +}; diff --git a/std/debug.zig b/std/debug/index.zig similarity index 94% rename from std/debug.zig rename to std/debug/index.zig index a683b5ae15d3beae19d17ae5f01441919533f0d4..e1025b291bf5227e0a54c7ae1fa19ba4f343e56c 100644 --- a/std/debug.zig +++ b/std/debug/index.zig @@ -1,10 +1,10 @@ -const std = @import("index.zig"); +const std = @import("../index.zig"); const math = std.math; const mem = std.mem; const io = std.io; const os = std.os; -const elf = @import("elf.zig"); -const DW = @import("dwarf.zig"); +const elf = std.elf; +const DW = std.dwarf; const ArrayList = std.ArrayList; const builtin = @import("builtin"); @@ -992,59 +992,3 @@ fn readILeb128(in_stream: &io.InStream) -> %i64 { pub const global_allocator = &global_fixed_allocator.allocator; var global_fixed_allocator = mem.FixedBufferAllocator.init(global_allocator_mem[0..]); var global_allocator_mem: [100 * 1024]u8 = undefined; - -/// Allocator that fails after N allocations, useful for making sure out of -/// memory conditions are handled correctly. -pub const FailingAllocator = struct { - allocator: mem.Allocator, - index: usize, - fail_index: usize, - internal_allocator: &mem.Allocator, - allocated_bytes: usize, - - pub fn init(allocator: &mem.Allocator, fail_index: usize) -> FailingAllocator { - return FailingAllocator { - .internal_allocator = allocator, - .fail_index = fail_index, - .index = 0, - .allocated_bytes = 0, - .allocator = mem.Allocator { - .allocFn = alloc, - .reallocFn = realloc, - .freeFn = free, - }, - }; - } - - fn alloc(allocator: &mem.Allocator, n: usize, alignment: u29) -> %[]u8 { - const self = @fieldParentPtr(FailingAllocator, "allocator", allocator); - if (self.index == self.fail_index) { - return error.OutOfMemory; - } - self.index += 1; - const result = %return self.internal_allocator.allocFn(self.internal_allocator, n, alignment); - self.allocated_bytes += result.len; - return result; - } - - fn realloc(allocator: &mem.Allocator, old_mem: []u8, new_size: usize, alignment: u29) -> %[]u8 { - const self = @fieldParentPtr(FailingAllocator, "allocator", allocator); - if (new_size <= old_mem.len) { - self.allocated_bytes -= old_mem.len - new_size; - return self.internal_allocator.reallocFn(self.internal_allocator, old_mem, new_size, alignment); - } - if (self.index == self.fail_index) { - return error.OutOfMemory; - } - self.index += 1; - const result = %return self.internal_allocator.reallocFn(self.internal_allocator, old_mem, new_size, alignment); - self.allocated_bytes += new_size - old_mem.len; - return result; - } - - fn free(allocator: &mem.Allocator, bytes: []u8) { - const self = @fieldParentPtr(FailingAllocator, "allocator", allocator); - self.allocated_bytes -= bytes.len; - return self.internal_allocator.freeFn(self.internal_allocator, bytes); - } -}; diff --git a/std/fmt/errol/index.zig b/std/fmt/errol/index.zig index 0a1ea7deef4e1a9d1f3cfb1d638bd3b307065919..ba4447c6315e825649f67a2a522ca728650769f3 100644 --- a/std/fmt/errol/index.zig +++ b/std/fmt/errol/index.zig @@ -1,10 +1,11 @@ +const std = @import("../../index.zig"); const enum3 = @import("enum3.zig").enum3; const enum3_data = @import("enum3.zig").enum3_data; const lookup_table = @import("lookup.zig").lookup_table; const HP = @import("lookup.zig").HP; -const math = @import("../../math/index.zig"); -const mem = @import("../../mem.zig"); -const assert = @import("../../debug.zig").assert; +const math = std.math; +const mem = std.mem; +const assert = std.debug.assert; pub const FloatDecimal = struct { digits: []u8, diff --git a/std/fmt/index.zig b/std/fmt/index.zig index fef968a1d5e8418014d2e134de391ca36fc8aa72..550fa1ce1f5ba993a9e69e81fde202551fe39348 100644 --- a/std/fmt/index.zig +++ b/std/fmt/index.zig @@ -1,7 +1,8 @@ -const math = @import("../math/index.zig"); -const debug = @import("../debug.zig"); +const std = @import("../index.zig"); +const math = std.math; +const debug = std.debug; const assert = debug.assert; -const mem = @import("../mem.zig"); +const mem = std.mem; const builtin = @import("builtin"); const errol3 = @import("errol/index.zig").errol3; diff --git a/std/hash_map.zig b/std/hash_map.zig index 837ee0742395b54e1622de121080a67ed0ae900f..cf83815798eff983b8da6b7da0dd6fc9b7e6f2d3 100644 --- a/std/hash_map.zig +++ b/std/hash_map.zig @@ -1,7 +1,8 @@ -const debug = @import("debug.zig"); +const std = @import("index.zig"); +const debug = std.debug; const assert = debug.assert; -const math = @import("math/index.zig"); -const mem = @import("mem.zig"); +const math = std.math; +const mem = std.mem; const Allocator = mem.Allocator; const builtin = @import("builtin"); diff --git a/std/heap.zig b/std/heap.zig index ec447c1aa82092f202bff583f89e11ab8257c60b..6a78692ec636a11b74d8a9c5b912914601092a60 100644 --- a/std/heap.zig +++ b/std/heap.zig @@ -1,10 +1,11 @@ -const debug = @import("debug.zig"); +const std = @import("index.zig"); +const debug = std.debug; const assert = debug.assert; -const mem = @import("mem.zig"); -const os = @import("os/index.zig"); +const mem = std.mem; +const os = std.os; const builtin = @import("builtin"); const Os = builtin.Os; -const c = @import("c/index.zig"); +const c = std.c; const Allocator = mem.Allocator; diff --git a/std/index.zig b/std/index.zig index 323eee203eeb706838b4052a07970ab064c86936..07da469b5e3d02683dda12fcc310c980ebf26422 100644 --- a/std/index.zig +++ b/std/index.zig @@ -11,7 +11,7 @@ pub const base64 = @import("base64.zig"); pub const build = @import("build.zig"); pub const c = @import("c/index.zig"); pub const cstr = @import("cstr.zig"); -pub const debug = @import("debug.zig"); +pub const debug = @import("debug/index.zig"); pub const dwarf = @import("dwarf.zig"); pub const elf = @import("elf.zig"); pub const empty_import = @import("empty.zig"); @@ -39,7 +39,7 @@ test "std" { _ = @import("build.zig"); _ = @import("c/index.zig"); _ = @import("cstr.zig"); - _ = @import("debug.zig"); + _ = @import("debug/index.zig"); _ = @import("dwarf.zig"); _ = @import("elf.zig"); _ = @import("empty.zig"); diff --git a/std/linked_list.zig b/std/linked_list.zig index f4b6d274c97f2af271be94f180d0815efa063b8c..3c516dab7d50f2decde3b442ca061cc93c60edbe 100644 --- a/std/linked_list.zig +++ b/std/linked_list.zig @@ -1,6 +1,7 @@ -const debug = @import("debug.zig"); +const std = @import("index.zig"); +const debug = std.debug; const assert = debug.assert; -const mem = @import("mem.zig"); +const mem = std.mem; const Allocator = mem.Allocator; /// Generic doubly linked list. diff --git a/std/math/acos.zig b/std/math/acos.zig index 7690497da5f627183f4b4420cb29b2ed877df501..478d5a846d325242ebd14a6a243c14318b576c99 100644 --- a/std/math/acos.zig +++ b/std/math/acos.zig @@ -2,8 +2,9 @@ // // - acos(x) = nan if x < -1 or x > 1 -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn acos(x: var) -> @typeOf(x) { const T = @typeOf(x); diff --git a/std/math/acosh.zig b/std/math/acosh.zig index 3b2c2c0f31472c0daf383d20f35e235fbaed4ed8..150bcd4543af42997b8b7b6f2096e9dc2a822e81 100644 --- a/std/math/acosh.zig +++ b/std/math/acosh.zig @@ -4,8 +4,9 @@ // - acosh(nan) = nan const builtin = @import("builtin"); -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn acosh(x: var) -> @typeOf(x) { const T = @typeOf(x); diff --git a/std/math/asin.zig b/std/math/asin.zig index c5d24c35e515f372df3edc8091091e9af3082a99..a0209be0c890fa961c7dc8491cf1c0ecec037c4d 100644 --- a/std/math/asin.zig +++ b/std/math/asin.zig @@ -3,8 +3,9 @@ // - asin(+-0) = +-0 // - asin(x) = nan if x < -1 or x > 1 -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn asin(x: var) -> @typeOf(x) { const T = @typeOf(x); diff --git a/std/math/asinh.zig b/std/math/asinh.zig index f963dae77bdf7f672d3fcabf80aff315e04aec99..d95565fc6dc4d150dbe3539b0adcdd80f5c8cf63 100644 --- a/std/math/asinh.zig +++ b/std/math/asinh.zig @@ -4,8 +4,9 @@ // - asinh(+-inf) = +-inf // - asinh(nan) = nan -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn asinh(x: var) -> @typeOf(x) { const T = @typeOf(x); diff --git a/std/math/atan.zig b/std/math/atan.zig index cf244eb7627769464097b1f8e891e65053fdf0e4..fbfade50a08df250efa0e7d61c26a95a4eb3d44f 100644 --- a/std/math/atan.zig +++ b/std/math/atan.zig @@ -3,8 +3,9 @@ // - atan(+-0) = +-0 // - atan(+-inf) = +-pi/2 -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn atan(x: var) -> @typeOf(x) { const T = @typeOf(x); diff --git a/std/math/atan2.zig b/std/math/atan2.zig index b3af18cd9e71f26ac660541c82e4e2594fec69a3..11e1b8cd8958cf1d0ae7a6d62a527959b5b15972 100644 --- a/std/math/atan2.zig +++ b/std/math/atan2.zig @@ -18,8 +18,9 @@ // atan2(+inf, x) = +pi/2 // atan2(-inf, x) = -pi/2 -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; fn atan2(comptime T: type, x: T, y: T) -> T { return switch (T) { diff --git a/std/math/atanh.zig b/std/math/atanh.zig index 13de90279bdb3dddc4d2efdbf57a37566f008ae9..e78750676557233999c259a09d9ee357ad541372 100644 --- a/std/math/atanh.zig +++ b/std/math/atanh.zig @@ -4,8 +4,9 @@ // - atanh(x) = nan if |x| > 1 with signal // - atanh(nan) = nan -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn atanh(x: var) -> @typeOf(x) { const T = @typeOf(x); diff --git a/std/math/cbrt.zig b/std/math/cbrt.zig index a8df75dff215c037307551e42b1db09de4f4905a..9725716f3bb4c0114b237e842d23a4554a881b65 100644 --- a/std/math/cbrt.zig +++ b/std/math/cbrt.zig @@ -4,8 +4,9 @@ // - cbrt(+-inf) = +-inf // - cbrt(nan) = nan -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn cbrt(x: var) -> @typeOf(x) { const T = @typeOf(x); diff --git a/std/math/ceil.zig b/std/math/ceil.zig index 8e27132e25d1e61783e051aa2851a18237330df7..141b5c0fc5d855464dd1adbd1cfb9757a0a49da6 100644 --- a/std/math/ceil.zig +++ b/std/math/ceil.zig @@ -5,8 +5,9 @@ // - ceil(nan) = nan const builtin = @import("builtin"); -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn ceil(x: var) -> @typeOf(x) { const T = @typeOf(x); diff --git a/std/math/copysign.zig b/std/math/copysign.zig index 05205e1a0e7e435901eca10138d02f13116ff84e..ebf12313fffbad231ea95a5f55ad9a245bb10dc3 100644 --- a/std/math/copysign.zig +++ b/std/math/copysign.zig @@ -1,5 +1,6 @@ -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn copysign(comptime T: type, x: T, y: T) -> T { return switch (T) { diff --git a/std/math/cos.zig b/std/math/cos.zig index 4c3b8e1282c477632028b23a4653ce9874aae64a..a65ea1ace80835ae2d46cd41c7108b47f22b4fb8 100644 --- a/std/math/cos.zig +++ b/std/math/cos.zig @@ -4,8 +4,9 @@ // - cos(nan) = nan const builtin = @import("builtin"); -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn cos(x: var) -> @typeOf(x) { const T = @typeOf(x); diff --git a/std/math/cosh.zig b/std/math/cosh.zig index 6d40d71b8da23e03f1feaae2c49800155dcbe531..05565d6b3ab677bddc2066b3a662bd1ce5764df4 100644 --- a/std/math/cosh.zig +++ b/std/math/cosh.zig @@ -5,9 +5,10 @@ // - cosh(nan) = nan const builtin = @import("builtin"); -const math = @import("index.zig"); +const std = @import("../index.zig"); +const math = std.math; const expo2 = @import("expo2.zig").expo2; -const assert = @import("../debug.zig").assert; +const assert = std.debug.assert; pub fn cosh(x: var) -> @typeOf(x) { const T = @typeOf(x); diff --git a/std/math/exp.zig b/std/math/exp.zig index 6e591daea3e0430c6f6d4fc05d88ffd347fabbdf..4cce18ffe5d70b141e89cef93556dcd26fb09f27 100644 --- a/std/math/exp.zig +++ b/std/math/exp.zig @@ -3,8 +3,9 @@ // - exp(+inf) = +inf // - exp(nan) = nan -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn exp(x: var) -> @typeOf(x) { const T = @typeOf(x); diff --git a/std/math/exp2.zig b/std/math/exp2.zig index 6061f323918f5005254d315c43d027620664a071..4ce7de909e580e7ad869d0d9aff16baa317b6bb4 100644 --- a/std/math/exp2.zig +++ b/std/math/exp2.zig @@ -3,8 +3,9 @@ // - exp2(+inf) = +inf // - exp2(nan) = nan -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn exp2(x: var) -> @typeOf(x) { const T = @typeOf(x); diff --git a/std/math/expm1.zig b/std/math/expm1.zig index fbe18410303f3d17de0ad05374b5492cb7ca72d0..10670c4cfcd0f2d5e3f21efd83ee590bd1c16927 100644 --- a/std/math/expm1.zig +++ b/std/math/expm1.zig @@ -4,8 +4,9 @@ // - expm1(-inf) = -1 // - expm1(nan) = nan -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn expm1(x: var) -> @typeOf(x) { const T = @typeOf(x); diff --git a/std/math/fabs.zig b/std/math/fabs.zig index cf1b8f1f14cc49a4bd417d45b369fa8820c670a2..dc1184dcc8fe8b02b7d1906d1cac4b8a8c00617d 100644 --- a/std/math/fabs.zig +++ b/std/math/fabs.zig @@ -3,8 +3,9 @@ // - fabs(+-inf) = +inf // - fabs(nan) = nan -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn fabs(x: var) -> @typeOf(x) { const T = @typeOf(x); diff --git a/std/math/floor.zig b/std/math/floor.zig index d7de45e9d01214526fd00cbdaea68bb7fc2a1c20..910dfd19016f45447348c9f903b299cbe94aeb55 100644 --- a/std/math/floor.zig +++ b/std/math/floor.zig @@ -5,8 +5,9 @@ // - floor(nan) = nan const builtin = @import("builtin"); -const assert = @import("../debug.zig").assert; -const math = @import("index.zig"); +const assert = std.debug.assert; +const std = @import("../index.zig"); +const math = std.math; pub fn floor(x: var) -> @typeOf(x) { const T = @typeOf(x); diff --git a/std/math/fma.zig b/std/math/fma.zig index 8e5adc80b24db5d6401b693884a4da9f26a80286..b48cfc83b2d08e0789e251f260871c23664970c2 100644 --- a/std/math/fma.zig +++ b/std/math/fma.zig @@ -1,5 +1,6 @@ -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn fma(comptime T: type, x: T, y: T, z: T) -> T { return switch (T) { diff --git a/std/math/frexp.zig b/std/math/frexp.zig index 1a317a2c80cf5e77c2d5083d8613d687f9d39268..a90121e5fe93966584b7590e92dd8a9aaaaf838c 100644 --- a/std/math/frexp.zig +++ b/std/math/frexp.zig @@ -4,8 +4,9 @@ // - frexp(+-inf) = +-inf, 0 // - frexp(nan) = nan, undefined -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; fn frexp_result(comptime T: type) -> type { return struct { diff --git a/std/math/hypot.zig b/std/math/hypot.zig index 9b09ed53a41159c43322bac16d063d0ad87b2a44..6c0039b176625f36861e695ede384c3786795655 100644 --- a/std/math/hypot.zig +++ b/std/math/hypot.zig @@ -5,8 +5,9 @@ // - hypot(nan, y) = nan // - hypot(x, nan) = nan -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn hypot(comptime T: type, x: T, y: T) -> T { return switch (T) { diff --git a/std/math/ilogb.zig b/std/math/ilogb.zig index 41a1e2d83f522a111861cd036a10fcd758a19a5e..db8e24d6c84910fce10c783e4af84ae4ae9d345e 100644 --- a/std/math/ilogb.zig +++ b/std/math/ilogb.zig @@ -4,8 +4,9 @@ // - ilogb(0) = @maxValue(i32) // - ilogb(nan) = @maxValue(i32) -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn ilogb(x: var) -> i32 { const T = @typeOf(x); diff --git a/std/math/index.zig b/std/math/index.zig index 1991864f691cb824ca4fdd7c575b89e6532b6637..d382154059d770a2e65b11820588941a48399d7e 100644 --- a/std/math/index.zig +++ b/std/math/index.zig @@ -1,6 +1,7 @@ const builtin = @import("builtin"); +const std = @import("../index.zig"); const TypeId = builtin.TypeId; -const assert = @import("../debug.zig").assert; +const assert = std.debug.assert; pub const e = 2.71828182845904523536028747135266249775724709369995; pub const pi = 3.14159265358979323846264338327950288419716939937510; diff --git a/std/math/inf.zig b/std/math/inf.zig index 546e6f3af8d61ade6160528eddc9715e962acd96..b253124c84dfd8ee56913fc7e84f48c2a93dcdd3 100644 --- a/std/math/inf.zig +++ b/std/math/inf.zig @@ -1,5 +1,6 @@ -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn inf(comptime T: type) -> T { return switch (T) { diff --git a/std/math/isfinite.zig b/std/math/isfinite.zig index d44d373cf14d207629e13d92e031f3d4e505b1cb..67fcf3cd18592d81ff4471fd36468cb13d734ee9 100644 --- a/std/math/isfinite.zig +++ b/std/math/isfinite.zig @@ -1,5 +1,6 @@ -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn isFinite(x: var) -> bool { const T = @typeOf(x); diff --git a/std/math/isinf.zig b/std/math/isinf.zig index 98c90e72a915ce8ee577b3646a448b1dc6dbbcd8..75529fbb5ee9d6be30247349054d1f716e8058e8 100644 --- a/std/math/isinf.zig +++ b/std/math/isinf.zig @@ -1,5 +1,6 @@ -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn isInf(x: var) -> bool { const T = @typeOf(x); diff --git a/std/math/isnan.zig b/std/math/isnan.zig index e996a726930071921c5b1e844c0e59df15f3eb99..d494dddca80727499a2890b4cb5577a53d5db937 100644 --- a/std/math/isnan.zig +++ b/std/math/isnan.zig @@ -1,5 +1,6 @@ -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn isNan(x: var) -> bool { const T = @typeOf(x); diff --git a/std/math/isnormal.zig b/std/math/isnormal.zig index f815c2680b760160c948b6806162ac7128da76b1..4d07bf4cb32f4bd320757b5fe70bbdb9b5a8aaec 100644 --- a/std/math/isnormal.zig +++ b/std/math/isnormal.zig @@ -1,5 +1,6 @@ -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn isNormal(x: var) -> bool { const T = @typeOf(x); diff --git a/std/math/ln.zig b/std/math/ln.zig index 4ded89d328d546ce02d012a1f631f1b57bb1f427..c5a5c93842cccbaa0a888d2cba1be8c7c53da521 100644 --- a/std/math/ln.zig +++ b/std/math/ln.zig @@ -5,8 +5,9 @@ // - ln(x) = nan if x < 0 // - ln(nan) = nan -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; const builtin = @import("builtin"); const TypeId = builtin.TypeId; diff --git a/std/math/log.zig b/std/math/log.zig index 1ff226f7e5b9dba79cfe8af39830f1d76109b422..4edb77bb1a96076c4773ebd83c0a94e445965b4d 100644 --- a/std/math/log.zig +++ b/std/math/log.zig @@ -1,7 +1,8 @@ -const math = @import("index.zig"); +const std = @import("../index.zig"); +const math = std.math; const builtin = @import("builtin"); const TypeId = builtin.TypeId; -const assert = @import("../debug.zig").assert; +const assert = std.debug.assert; pub fn log(comptime T: type, base: T, x: T) -> T { if (base == 2) { diff --git a/std/math/log10.zig b/std/math/log10.zig index 73168dec8db7ee446458ec7daacf8b71ecb23a23..0b6fc31aa774896d890e5b1ce4f164d3d92f7912 100644 --- a/std/math/log10.zig +++ b/std/math/log10.zig @@ -5,8 +5,9 @@ // - log10(x) = nan if x < 0 // - log10(nan) = nan -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; const builtin = @import("builtin"); const TypeId = builtin.TypeId; diff --git a/std/math/log1p.zig b/std/math/log1p.zig index b369385038d3bb014b4b1c545781b0236af9a96b..ce5aad1d85ece2eec3cc53ce7c4a77365600d529 100644 --- a/std/math/log1p.zig +++ b/std/math/log1p.zig @@ -6,8 +6,9 @@ // - log1p(x) = nan if x < -1 // - log1p(nan) = nan -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn log1p(x: var) -> @typeOf(x) { const T = @typeOf(x); diff --git a/std/math/log2.zig b/std/math/log2.zig index 1b38a9eceec62c9ae706f61ceb45932c8b8352d5..a9789e47cfbe936b2fa4fd3e4232cc58ceffbd51 100644 --- a/std/math/log2.zig +++ b/std/math/log2.zig @@ -5,8 +5,9 @@ // - log2(x) = nan if x < 0 // - log2(nan) = nan -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; const builtin = @import("builtin"); const TypeId = builtin.TypeId; diff --git a/std/math/modf.zig b/std/math/modf.zig index 72730b67d78c1ebc8a9db959e4e1471938e703e8..dc17f35b54b4b4382cd52f9e2fb641b1c1495f96 100644 --- a/std/math/modf.zig +++ b/std/math/modf.zig @@ -3,8 +3,9 @@ // - modf(+-inf) = +-inf, nan // - modf(nan) = nan, nan -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; fn modf_result(comptime T: type) -> type { return struct { diff --git a/std/math/pow.zig b/std/math/pow.zig index 55a2cd8c3e4036650469bb503c1805eb2b8011cb..b21fb3a9213b46a5fdb84de7b63dfe0a59ae32f8 100644 --- a/std/math/pow.zig +++ b/std/math/pow.zig @@ -22,8 +22,9 @@ // pow(x, y) = nan for finite x < 0 and finite non-integer y const builtin = @import("builtin"); -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; // This implementation is taken from the go stlib, musl is a bit more complex. pub fn pow(comptime T: type, x: T, y: T) -> T { diff --git a/std/math/round.zig b/std/math/round.zig index 1e193fb1d7a752fdf65d64015eac49946c6e62e6..3abee040ef74856810e60006668d86b95b14adc5 100644 --- a/std/math/round.zig +++ b/std/math/round.zig @@ -5,8 +5,9 @@ // - round(nan) = nan const builtin = @import("builtin"); -const assert = @import("../debug.zig").assert; -const math = @import("index.zig"); +const assert = std.debug.assert; +const std = @import("../index.zig"); +const math = std.math; pub fn round(x: var) -> @typeOf(x) { const T = @typeOf(x); diff --git a/std/math/scalbn.zig b/std/math/scalbn.zig index 0be6a3d47ef98043f384bf4c08ac5c27ce2f793c..6d1c77659303518b5bd4510f96fd1e7a29d59d0b 100644 --- a/std/math/scalbn.zig +++ b/std/math/scalbn.zig @@ -1,5 +1,6 @@ -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn scalbn(x: var, n: i32) -> @typeOf(x) { const T = @typeOf(x); diff --git a/std/math/signbit.zig b/std/math/signbit.zig index b8ccecfa1bcdb177739ec2d2b02739a7da659c32..b9bfe818de5e245b6ed45f507ecd94c9f6ec0945 100644 --- a/std/math/signbit.zig +++ b/std/math/signbit.zig @@ -1,5 +1,6 @@ -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn signbit(x: var) -> bool { const T = @typeOf(x); diff --git a/std/math/sin.zig b/std/math/sin.zig index 392bef1bc076921bc06cb69a2663262cbd1a741e..99008af469e1bbd12198384005e16e0deefc8d4b 100644 --- a/std/math/sin.zig +++ b/std/math/sin.zig @@ -5,8 +5,9 @@ // - sin(nan) = nan const builtin = @import("builtin"); -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn sin(x: var) -> @typeOf(x) { const T = @typeOf(x); diff --git a/std/math/sinh.zig b/std/math/sinh.zig index 4c575f10ec8cdf5dfaa753b58a14fa1172b26227..ca06bc615a75b7df86423802c953c115cd61ccb2 100644 --- a/std/math/sinh.zig +++ b/std/math/sinh.zig @@ -5,8 +5,9 @@ // - sinh(nan) = nan const builtin = @import("builtin"); -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; const expo2 = @import("expo2.zig").expo2; pub fn sinh(x: var) -> @typeOf(x) { diff --git a/std/math/sqrt.zig b/std/math/sqrt.zig index 263e616617a25fd91570403ca70f54687cf7c497..4d84756b4af62d110f769830eb2940d3b96a75ee 100644 --- a/std/math/sqrt.zig +++ b/std/math/sqrt.zig @@ -5,8 +5,9 @@ // - sqrt(x) = nan if x < 0 // - sqrt(nan) = nan -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; const builtin = @import("builtin"); const TypeId = builtin.TypeId; diff --git a/std/math/tan.zig b/std/math/tan.zig index ff53a758b4a3e19ffe2df814637ad8eb02f075f5..e62e9b889936a7977c34156858b490481da080df 100644 --- a/std/math/tan.zig +++ b/std/math/tan.zig @@ -5,8 +5,9 @@ // - tan(nan) = nan const builtin = @import("builtin"); -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn tan(x: var) -> @typeOf(x) { const T = @typeOf(x); diff --git a/std/math/tanh.zig b/std/math/tanh.zig index 7715029361b065fd733c6281e383270430d91d30..813b4f4561c60ca164cdea38e2b4e5ebff0e413f 100644 --- a/std/math/tanh.zig +++ b/std/math/tanh.zig @@ -5,8 +5,9 @@ // - sinh(nan) = nan const builtin = @import("builtin"); -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; const expo2 = @import("expo2.zig").expo2; pub fn tanh(x: var) -> @typeOf(x) { diff --git a/std/math/trunc.zig b/std/math/trunc.zig index 81eacb30bae791ee253bc4e7b58746d722e47e68..1d9032a22c807cb31c9605badc6dca1aec7f1ae7 100644 --- a/std/math/trunc.zig +++ b/std/math/trunc.zig @@ -4,8 +4,9 @@ // - trunc(+-inf) = +-inf // - trunc(nan) = nan -const math = @import("index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const math = std.math; +const assert = std.debug.assert; pub fn trunc(x: var) -> @typeOf(x) { const T = @typeOf(x); diff --git a/std/mem.zig b/std/mem.zig index 7438eba70ac92f564731693c3d30c75062b1b267..41a4155b60d5a650978bdbfc3e1f65e7588242b7 100644 --- a/std/mem.zig +++ b/std/mem.zig @@ -1,6 +1,7 @@ -const debug = @import("debug.zig"); +const std = @import("index.zig"); +const debug = std.debug; const assert = debug.assert; -const math = @import("math/index.zig"); +const math = std.math; const builtin = @import("builtin"); error OutOfMemory; diff --git a/std/net.zig b/std/net.zig index a5fd4d60368a012422ac2acf458ec1a1395c68c0..da078eab3f9c2ed20eb250c094a8fe294deb13e8 100644 --- a/std/net.zig +++ b/std/net.zig @@ -1,6 +1,7 @@ -const linux = @import("os/linux.zig"); -const assert = @import("debug.zig").assert; -const endian = @import("endian.zig"); +const std = @import("index.zig"); +const linux = std.os.linux; +const assert = std.debug.assert; +const endian = std.endian; error SigInterrupt; error Io; diff --git a/std/os/darwin.zig b/std/os/darwin.zig index e230826b7e5bc4ff46159559b1e13326b708174a..7e3e5e823e3ee3132e8237213bb1c86c872ae013 100644 --- a/std/os/darwin.zig +++ b/std/os/darwin.zig @@ -1,5 +1,6 @@ -const c = @import("../c/index.zig"); -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const c = std.c; +const assert = std.debug.assert; pub use @import("darwin_errno.zig"); diff --git a/std/os/index.zig b/std/os/index.zig index 8e79eda40bc0030183099f9014215af41c6c0feb..0fd3f02e9a4e185c6ff24bd4d82a05a0d066b02f 100644 --- a/std/os/index.zig +++ b/std/os/index.zig @@ -1,3 +1,4 @@ +const std = @import("../index.zig"); const builtin = @import("builtin"); const Os = builtin.Os; const is_windows = builtin.os == Os.windows; @@ -37,22 +38,22 @@ pub const createWindowsEnvBlock = windows_util.createWindowsEnvBlock; pub const FileHandle = if (is_windows) windows.HANDLE else i32; -const debug = @import("../debug.zig"); +const debug = std.debug; const assert = debug.assert; -const c = @import("../c/index.zig"); +const c = std.c; -const mem = @import("../mem.zig"); +const mem = std.mem; const Allocator = mem.Allocator; -const BufMap = @import("../buf_map.zig").BufMap; -const cstr = @import("../cstr.zig"); +const BufMap = std.BufMap; +const cstr = std.cstr; -const io = @import("../io.zig"); -const base64 = @import("../base64.zig"); -const ArrayList = @import("../array_list.zig").ArrayList; -const Buffer = @import("../buffer.zig").Buffer; -const math = @import("../index.zig").math; +const io = std.io; +const base64 = std.base64; +const ArrayList = std.ArrayList; +const Buffer = std.Buffer; +const math = std.math; error SystemResources; error AccessDenied; diff --git a/std/os/linux.zig b/std/os/linux.zig index f9baa43098e6515fb958bdfa197e7422b34d77de..c254f83d10139a7dbdf7a8c564fd690130cd0089 100644 --- a/std/os/linux.zig +++ b/std/os/linux.zig @@ -1,4 +1,5 @@ -const assert = @import("../debug.zig").assert; +const std = @import("../index.zig"); +const assert = std.debug.assert; const builtin = @import("builtin"); const arch = switch (builtin.arch) { builtin.Arch.x86_64 => @import("linux_x86_64.zig"), diff --git a/std/os/path.zig b/std/os/path.zig index db514add9ca0a9546aa4b3b00b7edce230b90ebb..9417cb4299dc778fe94581d065aa33003ac5bfad 100644 --- a/std/os/path.zig +++ b/std/os/path.zig @@ -1,16 +1,16 @@ +const std = @import("../index.zig"); const builtin = @import("builtin"); const Os = builtin.Os; -const debug = @import("../debug.zig"); +const debug = std.debug; const assert = debug.assert; -const mem = @import("../mem.zig"); -const fmt = @import("../fmt/index.zig"); +const mem = std.mem; +const fmt = std.fmt; const Allocator = mem.Allocator; -const os = @import("index.zig"); -const math = @import("../math/index.zig"); +const os = std.os; +const math = std.math; const posix = os.posix; const windows = os.windows; -const c = @import("../c/index.zig"); -const cstr = @import("../cstr.zig"); +const cstr = std.cstr; pub const sep_windows = '\\'; pub const sep_posix = '/'; diff --git a/std/rand.zig b/std/rand.zig index 73801a078fae816c19802a9808fd33d7d4f2bfce..f35229ea3c0f4c8a9f434c22ac852954f554cbe4 100644 --- a/std/rand.zig +++ b/std/rand.zig @@ -1,8 +1,9 @@ +const std = @import("index.zig"); const builtin = @import("builtin"); -const assert = @import("debug.zig").assert; +const assert = std.debug.assert; const rand_test = @import("rand_test.zig"); -const mem = @import("mem.zig"); -const math = @import("math/index.zig"); +const mem = std.mem; +const math = std.math; pub const MT19937_32 = MersenneTwister( u32, 624, 397, 31, diff --git a/std/special/compiler_rt/fixunsdfdi_test.zig b/std/special/compiler_rt/fixunsdfdi_test.zig index cb4a52b9edea95ea60331a6f85207391b9a8ad2b..2a0e778ba3ca66c4fbb7aa03b2f89b2161b83521 100644 --- a/std/special/compiler_rt/fixunsdfdi_test.zig +++ b/std/special/compiler_rt/fixunsdfdi_test.zig @@ -1,5 +1,5 @@ const __fixunsdfdi = @import("fixunsdfdi.zig").__fixunsdfdi; -const assert = @import("../../debug.zig").assert; +const assert = @import("../../index.zig").debug.assert; fn test__fixunsdfdi(a: f64, expected: u64) { const x = __fixunsdfdi(a); diff --git a/std/special/compiler_rt/fixunsdfsi_test.zig b/std/special/compiler_rt/fixunsdfsi_test.zig index eef374773d4c0b3d955838de11bf46507900bbe3..6116391391a82bd9a9d559298f2bb166a664d6fc 100644 --- a/std/special/compiler_rt/fixunsdfsi_test.zig +++ b/std/special/compiler_rt/fixunsdfsi_test.zig @@ -1,5 +1,5 @@ const __fixunsdfsi = @import("fixunsdfsi.zig").__fixunsdfsi; -const assert = @import("../../debug.zig").assert; +const assert = @import("../../index.zig").debug.assert; fn test__fixunsdfsi(a: f64, expected: u32) { const x = __fixunsdfsi(a); diff --git a/std/special/compiler_rt/fixunsdfti_test.zig b/std/special/compiler_rt/fixunsdfti_test.zig index cd348fffde90e9026880c23bfdce888d7049c260..dc7f1c29cd768bd17107ef6fff4a996b24f0e439 100644 --- a/std/special/compiler_rt/fixunsdfti_test.zig +++ b/std/special/compiler_rt/fixunsdfti_test.zig @@ -1,5 +1,5 @@ const __fixunsdfti = @import("fixunsdfti.zig").__fixunsdfti; -const assert = @import("../../debug.zig").assert; +const assert = @import("../../index.zig").debug.assert; fn test__fixunsdfti(a: f64, expected: u128) { const x = __fixunsdfti(a); diff --git a/std/special/compiler_rt/fixunssfdi_test.zig b/std/special/compiler_rt/fixunssfdi_test.zig index 67e3cd24c4bd9cd31db7703b74368a8011e1d8ae..41827a083480add05fd83607d213a26681802a67 100644 --- a/std/special/compiler_rt/fixunssfdi_test.zig +++ b/std/special/compiler_rt/fixunssfdi_test.zig @@ -1,5 +1,5 @@ const __fixunssfdi = @import("fixunssfdi.zig").__fixunssfdi; -const assert = @import("../../debug.zig").assert; +const assert = @import("../../index.zig").debug.assert; fn test__fixunssfdi(a: f32, expected: u64) { const x = __fixunssfdi(a); diff --git a/std/special/compiler_rt/fixunssfsi_test.zig b/std/special/compiler_rt/fixunssfsi_test.zig index bdb033933553881a8df12b01ae1d9e97074f6c68..664c02ea73685efa48fc17aa33c917b5b2d95d77 100644 --- a/std/special/compiler_rt/fixunssfsi_test.zig +++ b/std/special/compiler_rt/fixunssfsi_test.zig @@ -1,5 +1,5 @@ const __fixunssfsi = @import("fixunssfsi.zig").__fixunssfsi; -const assert = @import("../../debug.zig").assert; +const assert = @import("../../index.zig").debug.assert; fn test__fixunssfsi(a: f32, expected: u32) { const x = __fixunssfsi(a); diff --git a/std/special/compiler_rt/fixunssfti_test.zig b/std/special/compiler_rt/fixunssfti_test.zig index aaa7c70ab7077d763b363d8ff3b77f5c59a4d198..712df893c1a6a9bbad7e0591669742ca2b76dbf0 100644 --- a/std/special/compiler_rt/fixunssfti_test.zig +++ b/std/special/compiler_rt/fixunssfti_test.zig @@ -1,5 +1,5 @@ const __fixunssfti = @import("fixunssfti.zig").__fixunssfti; -const assert = @import("../../debug.zig").assert; +const assert = @import("../../index.zig").debug.assert; fn test__fixunssfti(a: f32, expected: u128) { const x = __fixunssfti(a); diff --git a/std/special/compiler_rt/fixunstfdi_test.zig b/std/special/compiler_rt/fixunstfdi_test.zig index c33062fad801b940174b297c805dc8ea78abdc75..b5526f62a61bf77e74de25857b94d87174fa0f05 100644 --- a/std/special/compiler_rt/fixunstfdi_test.zig +++ b/std/special/compiler_rt/fixunstfdi_test.zig @@ -1,5 +1,5 @@ const __fixunstfdi = @import("fixunstfdi.zig").__fixunstfdi; -const assert = @import("../../debug.zig").assert; +const assert = @import("../../index.zig").debug.assert; fn test__fixunstfdi(a: f128, expected: u64) { const x = __fixunstfdi(a); diff --git a/std/special/compiler_rt/fixunstfsi_test.zig b/std/special/compiler_rt/fixunstfsi_test.zig index 87bb1b9fa7bfcfe4565288c94563fd67f0765505..74b3507c44135b38d6137f8d0fa2963f0e05f310 100644 --- a/std/special/compiler_rt/fixunstfsi_test.zig +++ b/std/special/compiler_rt/fixunstfsi_test.zig @@ -1,5 +1,5 @@ const __fixunstfsi = @import("fixunstfsi.zig").__fixunstfsi; -const assert = @import("../../debug.zig").assert; +const assert = @import("../../index.zig").debug.assert; fn test__fixunstfsi(a: f128, expected: u32) { const x = __fixunstfsi(a); diff --git a/std/special/compiler_rt/fixunstfti_test.zig b/std/special/compiler_rt/fixunstfti_test.zig index f18c39d04dc1be01ec0a534dafa0b8526e4cd512..a6c9ea0f688e30ceb0df1f1cbbd7325025fd67a4 100644 --- a/std/special/compiler_rt/fixunstfti_test.zig +++ b/std/special/compiler_rt/fixunstfti_test.zig @@ -1,5 +1,5 @@ const __fixunstfti = @import("fixunstfti.zig").__fixunstfti; -const assert = @import("../../debug.zig").assert; +const assert = @import("../../index.zig").debug.assert; fn test__fixunstfti(a: f128, expected: u128) { const x = __fixunstfti(a); diff --git a/std/special/compiler_rt/index.zig b/std/special/compiler_rt/index.zig index fab7b7c878ee400cc8269601f801e30f6eaeaa8f..5034a6fd906608e9c3d98298430211e7ddd8fd7e 100644 --- a/std/special/compiler_rt/index.zig +++ b/std/special/compiler_rt/index.zig @@ -68,7 +68,7 @@ comptime { } } -const assert = @import("../../debug.zig").assert; +const assert = @import("../../index.zig").debug.assert; const __udivmoddi4 = @import("udivmoddi4.zig").__udivmoddi4; -- 2.54.0