From c08b190c6918b33d27ceffe1ab3afd5d7f6370ea Mon Sep 17 00:00:00 2001 From: Meghan Date: Fri, 7 Jan 2022 00:06:06 -0500 Subject: [PATCH] lint: duplicate import (#10519) --- lib/std/hash.zig | 14 +++++++------- lib/std/special/compiler_rt/int.zig | 7 ++++--- lib/std/special/compiler_rt/multi3.zig | 2 +- lib/std/special/compiler_rt/negsi2_test.zig | 5 +++-- lib/std/special/compiler_rt/paritydi2_test.zig | 5 +++-- lib/std/special/compiler_rt/paritysi2_test.zig | 5 +++-- lib/std/special/compiler_rt/parityti2_test.zig | 5 +++-- lib/std/special/compiler_rt/popcountdi2_test.zig | 5 +++-- lib/std/special/compiler_rt/popcountsi2_test.zig | 5 +++-- lib/std/special/compiler_rt/popcountti2_test.zig | 5 +++-- lib/std/special/compiler_rt/truncXfYf2_test.zig | 5 +++-- lib/std/special/compiler_rt/udivmod.zig | 7 ++++--- lib/std/time.zig | 2 +- lib/std/valgrind.zig | 4 ++-- lib/std/zig/system/darwin.zig | 2 +- src/Compilation.zig | 5 +++-- src/mingw.zig | 2 +- src/tracy.zig | 7 ++++--- src/translate_c.zig | 4 ++-- test/behavior/cast.zig | 6 ++---- test/behavior/enum_stage1.zig | 7 ++++--- test/behavior/import.zig | 5 +++-- test/behavior/int128.zig | 6 ++---- .../ref_var_in_if_after_if_2nd_switch_prong.zig | 5 +++-- test/behavior/reflection.zig | 5 +++-- test/behavior/translate_c_macros.zig | 5 +++-- test/behavior/translate_c_macros_stage1.zig | 5 +++-- test/behavior/widening.zig | 5 +++-- test/standalone/install_raw_hex/build.zig | 3 +-- 29 files changed, 81 insertions(+), 67 deletions(-) diff --git a/lib/std/hash.zig b/lib/std/hash.zig index f96d331d0fde18e35de4c0392ae1f798ce73d99d..2680a8e263325efcab1038beb0d93227da0b6315 100644 --- a/lib/std/hash.zig +++ b/lib/std/hash.zig @@ -33,11 +33,11 @@ const wyhash = @import("hash/wyhash.zig"); pub const Wyhash = wyhash.Wyhash; test "hash" { - _ = @import("hash/adler.zig"); - _ = @import("hash/auto_hash.zig"); - _ = @import("hash/crc.zig"); - _ = @import("hash/fnv.zig"); - _ = @import("hash/murmur.zig"); - _ = @import("hash/cityhash.zig"); - _ = @import("hash/wyhash.zig"); + _ = adler; + _ = auto_hash; + _ = crc; + _ = fnv; + _ = murmur; + _ = cityhash; + _ = wyhash; } diff --git a/lib/std/special/compiler_rt/int.zig b/lib/std/special/compiler_rt/int.zig index e4d9df7a22c1b4825229b9d8ab1bb3640c68052f..0f3400d37edbf3e8c1f7592e69c2f67d76ba4d2c 100644 --- a/lib/std/special/compiler_rt/int.zig +++ b/lib/std/special/compiler_rt/int.zig @@ -1,8 +1,9 @@ // Builtin functions that operate on integer types const builtin = @import("builtin"); -const testing = @import("std").testing; -const maxInt = @import("std").math.maxInt; -const minInt = @import("std").math.minInt; +const std = @import("std"); +const testing = std.testing; +const maxInt = std.math.maxInt; +const minInt = std.math.minInt; const udivmod = @import("udivmod.zig").udivmod; diff --git a/lib/std/special/compiler_rt/multi3.zig b/lib/std/special/compiler_rt/multi3.zig index a05fb3bd6d53c66ed88bff81be9afb1538c4225e..4e5c49730ad7a44145289cf6b700e75d026d2296 100644 --- a/lib/std/special/compiler_rt/multi3.zig +++ b/lib/std/special/compiler_rt/multi3.zig @@ -17,7 +17,7 @@ pub fn __multi3(a: i128, b: i128) callconv(.C) i128 { return r.all; } -const v128 = @import("std").meta.Vector(2, u64); +const v128 = std.meta.Vector(2, u64); pub fn __multi3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 { return @bitCast(v128, @call(.{ .modifier = .always_inline }, __multi3, .{ @bitCast(i128, a), diff --git a/lib/std/special/compiler_rt/negsi2_test.zig b/lib/std/special/compiler_rt/negsi2_test.zig index 9458ea995cc289f12045e63732c0964388a33eb1..608a44c12fdc7427860385463e97c66d5733c13c 100644 --- a/lib/std/special/compiler_rt/negsi2_test.zig +++ b/lib/std/special/compiler_rt/negsi2_test.zig @@ -1,7 +1,8 @@ +const std = @import("std"); const neg = @import("negXi2.zig"); -const testing = @import("std").testing; +const testing = std.testing; -const print = @import("std").debug.print; +const print = std.debug.print; fn test__negsi2(a: i32, expected: i32) !void { var result = neg.__negsi2(a); diff --git a/lib/std/special/compiler_rt/paritydi2_test.zig b/lib/std/special/compiler_rt/paritydi2_test.zig index 7c481bbaef3c5dd7b1f2cf12d1904e87de685209..a13abda5feef052c00aa31244b429100aebd505d 100644 --- a/lib/std/special/compiler_rt/paritydi2_test.zig +++ b/lib/std/special/compiler_rt/paritydi2_test.zig @@ -1,5 +1,6 @@ +const std = @import("std"); const parity = @import("parity.zig"); -const testing = @import("std").testing; +const testing = std.testing; fn paritydi2Naive(a: i64) i32 { var x = @bitCast(u64, a); @@ -25,7 +26,7 @@ test "paritydi2" { try test__paritydi2(@bitCast(i64, @as(u64, 0xffffffff_fffffffe))); try test__paritydi2(@bitCast(i64, @as(u64, 0xffffffff_ffffffff))); - const RndGen = @import("std").rand.DefaultPrng; + const RndGen = std.rand.DefaultPrng; var rnd = RndGen.init(42); var i: u32 = 0; while (i < 10_000) : (i += 1) { diff --git a/lib/std/special/compiler_rt/paritysi2_test.zig b/lib/std/special/compiler_rt/paritysi2_test.zig index c4386bcf1f4e326f7c3e6c031f573ddec19acde7..f63854e34f07c13640bbf94c56eabe367e4d00eb 100644 --- a/lib/std/special/compiler_rt/paritysi2_test.zig +++ b/lib/std/special/compiler_rt/paritysi2_test.zig @@ -1,5 +1,6 @@ +const std = @import("std"); const parity = @import("parity.zig"); -const testing = @import("std").testing; +const testing = std.testing; fn paritysi2Naive(a: i32) i32 { var x = @bitCast(u32, a); @@ -25,7 +26,7 @@ test "paritysi2" { try test__paritysi2(@bitCast(i32, @as(u32, 0xfffffffe))); try test__paritysi2(@bitCast(i32, @as(u32, 0xffffffff))); - const RndGen = @import("std").rand.DefaultPrng; + const RndGen = std.rand.DefaultPrng; var rnd = RndGen.init(42); var i: u32 = 0; while (i < 10_000) : (i += 1) { diff --git a/lib/std/special/compiler_rt/parityti2_test.zig b/lib/std/special/compiler_rt/parityti2_test.zig index 0de07df31aa8a4e4fecd857faeb658f07df1afe6..e01893255549f4b22bce81ca65f69f434da08b29 100644 --- a/lib/std/special/compiler_rt/parityti2_test.zig +++ b/lib/std/special/compiler_rt/parityti2_test.zig @@ -1,5 +1,6 @@ +const std = @import("std"); const parity = @import("parity.zig"); -const testing = @import("std").testing; +const testing = std.testing; fn parityti2Naive(a: i128) i32 { var x = @bitCast(u128, a); @@ -25,7 +26,7 @@ test "parityti2" { try test__parityti2(@bitCast(i128, @as(u128, 0xffffffff_ffffffff_ffffffff_fffffffe))); try test__parityti2(@bitCast(i128, @as(u128, 0xffffffff_ffffffff_ffffffff_ffffffff))); - const RndGen = @import("std").rand.DefaultPrng; + const RndGen = std.rand.DefaultPrng; var rnd = RndGen.init(42); var i: u32 = 0; while (i < 10_000) : (i += 1) { diff --git a/lib/std/special/compiler_rt/popcountdi2_test.zig b/lib/std/special/compiler_rt/popcountdi2_test.zig index e20693987a48ee550567096e854c396aea3c7fc8..e02628e636ce6810267c161ed562049653998578 100644 --- a/lib/std/special/compiler_rt/popcountdi2_test.zig +++ b/lib/std/special/compiler_rt/popcountdi2_test.zig @@ -1,5 +1,6 @@ +const std = @import("std"); const popcount = @import("popcount.zig"); -const testing = @import("std").testing; +const testing = std.testing; fn popcountdi2Naive(a: i64) i32 { var x = a; @@ -24,7 +25,7 @@ test "popcountdi2" { try test__popcountdi2(@bitCast(i64, @as(u64, 0xffffffff_fffffffe))); try test__popcountdi2(@bitCast(i64, @as(u64, 0xffffffff_ffffffff))); - const RndGen = @import("std").rand.DefaultPrng; + const RndGen = std.rand.DefaultPrng; var rnd = RndGen.init(42); var i: u32 = 0; while (i < 10_000) : (i += 1) { diff --git a/lib/std/special/compiler_rt/popcountsi2_test.zig b/lib/std/special/compiler_rt/popcountsi2_test.zig index c0c92e396ebea45fa07f28572965b364150d6502..7606b1a97e79f173b9baaeff0f217d0f70f4dfec 100644 --- a/lib/std/special/compiler_rt/popcountsi2_test.zig +++ b/lib/std/special/compiler_rt/popcountsi2_test.zig @@ -1,5 +1,6 @@ +const std = @import("std"); const popcount = @import("popcount.zig"); -const testing = @import("std").testing; +const testing = std.testing; fn popcountsi2Naive(a: i32) i32 { var x = a; @@ -24,7 +25,7 @@ test "popcountsi2" { try test__popcountsi2(@bitCast(i32, @as(u32, 0xfffffffe))); try test__popcountsi2(@bitCast(i32, @as(u32, 0xffffffff))); - const RndGen = @import("std").rand.DefaultPrng; + const RndGen = std.rand.DefaultPrng; var rnd = RndGen.init(42); var i: u32 = 0; while (i < 10_000) : (i += 1) { diff --git a/lib/std/special/compiler_rt/popcountti2_test.zig b/lib/std/special/compiler_rt/popcountti2_test.zig index 83f2a18e7d4f70cf69df6dfd595811ddcb1e3259..fae2beccd4f47a4ab4f70a81b460ce34e91945a9 100644 --- a/lib/std/special/compiler_rt/popcountti2_test.zig +++ b/lib/std/special/compiler_rt/popcountti2_test.zig @@ -1,5 +1,6 @@ +const std = @import("std"); const popcount = @import("popcount.zig"); -const testing = @import("std").testing; +const testing = std.testing; fn popcountti2Naive(a: i128) i32 { var x = a; @@ -24,7 +25,7 @@ test "popcountti2" { try test__popcountti2(@bitCast(i128, @as(u128, 0xffffffff_ffffffff_ffffffff_fffffffe))); try test__popcountti2(@bitCast(i128, @as(u128, 0xffffffff_ffffffff_ffffffff_ffffffff))); - const RndGen = @import("std").rand.DefaultPrng; + const RndGen = std.rand.DefaultPrng; var rnd = RndGen.init(42); var i: u32 = 0; while (i < 10_000) : (i += 1) { diff --git a/lib/std/special/compiler_rt/truncXfYf2_test.zig b/lib/std/special/compiler_rt/truncXfYf2_test.zig index 1464c3bfcb84f8cc503ab39396fe172d853c13db..3f11dd0380a63a0e8b6f4417baba09abbf1acb02 100644 --- a/lib/std/special/compiler_rt/truncXfYf2_test.zig +++ b/lib/std/special/compiler_rt/truncXfYf2_test.zig @@ -1,3 +1,4 @@ +const std = @import("std"); const __truncsfhf2 = @import("truncXfYf2.zig").__truncsfhf2; fn test__truncsfhf2(a: u32, expected: u16) !void { @@ -217,7 +218,7 @@ fn test__truncdfsf2(a: f64, expected: u32) void { } } - @import("std").debug.print("got 0x{x} wanted 0x{x}\n", .{ rep, expected }); + std.debug.print("got 0x{x} wanted 0x{x}\n", .{ rep, expected }); @panic("__trunctfsf2 test failure"); } @@ -248,7 +249,7 @@ fn test__trunctfhf2(a: f128, expected: u16) void { return; } - @import("std").debug.print("got 0x{x} wanted 0x{x}\n", .{ rep, expected }); + std.debug.print("got 0x{x} wanted 0x{x}\n", .{ rep, expected }); @panic("__trunctfhf2 test failure"); } diff --git a/lib/std/special/compiler_rt/udivmod.zig b/lib/std/special/compiler_rt/udivmod.zig index b2fe2048d448672e1a46b1c9734b1c88453c2459..d941c242d2cff3b6fc57e4a4516103c72e4e9f6a 100644 --- a/lib/std/special/compiler_rt/udivmod.zig +++ b/lib/std/special/compiler_rt/udivmod.zig @@ -1,6 +1,7 @@ const builtin = @import("builtin"); const is_test = builtin.is_test; const native_endian = builtin.cpu.arch.endian(); +const std = @import("std"); const low = switch (native_endian) { .Big => 1, @@ -13,9 +14,9 @@ pub fn udivmod(comptime DoubleInt: type, a: DoubleInt, b: DoubleInt, maybe_rem: const double_int_bits = @typeInfo(DoubleInt).Int.bits; const single_int_bits = @divExact(double_int_bits, 2); - const SingleInt = @import("std").meta.Int(.unsigned, single_int_bits); - const SignedDoubleInt = @import("std").meta.Int(.signed, double_int_bits); - const Log2SingleInt = @import("std").math.Log2Int(SingleInt); + const SingleInt = std.meta.Int(.unsigned, single_int_bits); + const SignedDoubleInt = std.meta.Int(.signed, double_int_bits); + const Log2SingleInt = std.math.Log2Int(SingleInt); const n = @ptrCast(*const [2]SingleInt, &a).*; // TODO issue #421 const d = @ptrCast(*const [2]SingleInt, &b).*; // TODO issue #421 diff --git a/lib/std/time.zig b/lib/std/time.zig index b9580f5f3ee4fe59da7c7bf83a2ccad02d3c8cbb..e8e1d1010c91f701069379a365890a9fe7021f6c 100644 --- a/lib/std/time.zig +++ b/lib/std/time.zig @@ -287,5 +287,5 @@ test "Timer" { } test { - _ = @import("time/epoch.zig"); + _ = epoch; } diff --git a/lib/std/valgrind.zig b/lib/std/valgrind.zig index 91034fa03ece9c8968e36cc1dacb03cff4ff32a4..7532e73e490df3803011b8560be62bb5da5b1642 100644 --- a/lib/std/valgrind.zig +++ b/lib/std/valgrind.zig @@ -258,6 +258,6 @@ pub const memcheck = @import("valgrind/memcheck.zig"); pub const callgrind = @import("valgrind/callgrind.zig"); test { - _ = @import("valgrind/memcheck.zig"); - _ = @import("valgrind/callgrind.zig"); + _ = memcheck; + _ = callgrind; } diff --git a/lib/std/zig/system/darwin.zig b/lib/std/zig/system/darwin.zig index c20607440d2ea615725e29eca9edd8d2e4a4ab90..52abddc06a2ab9014bdce9ce209ee1a3cabfdd7f 100644 --- a/lib/std/zig/system/darwin.zig +++ b/lib/std/zig/system/darwin.zig @@ -88,5 +88,5 @@ pub const DarwinSDK = struct { }; test "" { - _ = @import("darwin/macos.zig"); + _ = macos; } diff --git a/src/Compilation.zig b/src/Compilation.zig index 40aabcae366a1603c960339c4d4ed2b08c5b1459..ea243dd73d21aef217027b91527e1a07054e225f 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -34,6 +34,7 @@ const ThreadPool = @import("ThreadPool.zig"); const WaitGroup = @import("WaitGroup.zig"); const libtsan = @import("libtsan.zig"); const Zir = @import("Zir.zig"); +const Color = @import("main.zig").Color; /// General-purpose allocator. Used for both temporary and long-term storage. gpa: Allocator, @@ -148,7 +149,7 @@ owned_link_dir: ?std.fs.Dir, /// This is for stage1 and should be deleted upon completion of self-hosting. /// Don't use this for anything other than stage1 compatibility. -color: @import("main.zig").Color = .auto, +color: Color = .auto, /// This mutex guards all `Compilation` mutable state. mutex: std.Thread.Mutex = .{}, @@ -790,7 +791,7 @@ pub const InitOptions = struct { machine_code_model: std.builtin.CodeModel = .default, clang_preprocessor_mode: ClangPreprocessorMode = .no, /// This is for stage1 and should be deleted upon completion of self-hosting. - color: @import("main.zig").Color = .auto, + color: Color = .auto, test_filter: ?[]const u8 = null, test_name_prefix: ?[]const u8 = null, subsystem: ?std.Target.SubSystem = null, diff --git a/src/mingw.zig b/src/mingw.zig index 264740c333584752e427a8101a83cc73d1cde056..f555634459db7d31f5296af55bc7d1207e485b08 100644 --- a/src/mingw.zig +++ b/src/mingw.zig @@ -408,7 +408,7 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void { errdefer comp.gpa.free(lib_final_path); const llvm = @import("codegen/llvm/bindings.zig"); - const arch_type = @import("target.zig").archToLLVM(target.cpu.arch); + const arch_type = target_util.archToLLVM(target.cpu.arch); const def_final_path_z = try arena.dupeZ(u8, def_final_path); const lib_final_path_z = try arena.dupeZ(u8, lib_final_path); if (llvm.WriteImportLibrary(def_final_path_z.ptr, arch_type, lib_final_path_z.ptr, true)) { diff --git a/src/tracy.zig b/src/tracy.zig index 033cf1bcf04d3206d315b659568b257ea41ff573..4ecae74481f254b10e85abc68a0c7810d6b13f33 100644 --- a/src/tracy.zig +++ b/src/tracy.zig @@ -1,9 +1,10 @@ const std = @import("std"); const builtin = @import("builtin"); +const build_options = @import("build_options"); -pub const enable = if (builtin.is_test) false else @import("build_options").enable_tracy; -pub const enable_allocation = enable and @import("build_options").enable_tracy_allocation; -pub const enable_callstack = enable and @import("build_options").enable_tracy_callstack; +pub const enable = if (builtin.is_test) false else build_options.enable_tracy; +pub const enable_allocation = enable and build_options.enable_tracy_allocation; +pub const enable_callstack = enable and build_options.enable_tracy_callstack; // TODO: make this configurable const callstack_depth = 10; diff --git a/src/translate_c.zig b/src/translate_c.zig index 79d68ff51bc84fdd1c21fbdf16ee6fdebe11f6c8..4d993e62ea366b663055a09515bb287ed621219a 100644 --- a/src/translate_c.zig +++ b/src/translate_c.zig @@ -820,7 +820,7 @@ fn visitVarDecl(c: *Context, var_decl: *const clang.VarDecl, mangled_name: ?[]co // The C language specification states that variables with static or threadlocal // storage without an initializer are initialized to a zero value. - // @import("std").mem.zeroes(T) + // std.mem.zeroes(T) init_node = try Tag.std_mem_zeroes.create(c.arena, type_node); } @@ -5211,7 +5211,7 @@ const MacroSlicer = struct { // mapped function exists in `std.zig.c_translation.Macros` test "Macro matching" { const helper = struct { - const MacroFunctions = @import("std").zig.c_translation.Macros; + const MacroFunctions = std.zig.c_translation.Macros; fn checkMacro(allocator: mem.Allocator, pattern_list: PatternList, source: []const u8, comptime expected_match: ?[]const u8) !void { var tok_list = std.ArrayList(CToken).init(allocator); defer tok_list.deinit(); diff --git a/test/behavior/cast.zig b/test/behavior/cast.zig index d1edefeb2d2c957b39a06dce9b512ffbc00fbb24..e84eed60d4856bae5418719800e500b40c71b42b 100644 --- a/test/behavior/cast.zig +++ b/test/behavior/cast.zig @@ -2,6 +2,7 @@ const std = @import("std"); const expect = std.testing.expect; const mem = std.mem; const maxInt = std.math.maxInt; +const builtin = @import("builtin"); test "int to ptr cast" { const x = @as(usize, 13); @@ -252,10 +253,7 @@ test "array coersion to undefined at runtime" { @setRuntimeSafety(true); // TODO implement @setRuntimeSafety in stage2 - if (@import("builtin").zig_is_stage2 and - @import("builtin").mode != .Debug and - @import("builtin").mode != .ReleaseSafe) - { + if (builtin.zig_is_stage2 and builtin.mode != .Debug and builtin.mode != .ReleaseSafe) { return error.SkipZigTest; } diff --git a/test/behavior/enum_stage1.zig b/test/behavior/enum_stage1.zig index c9658918f86ee3c99ed2dedf595d7439fbf96e94..f8d9d0a1b23f007982f2eb29280484bc7cd4be8c 100644 --- a/test/behavior/enum_stage1.zig +++ b/test/behavior/enum_stage1.zig @@ -1,6 +1,7 @@ -const expect = @import("std").testing.expect; -const mem = @import("std").mem; -const Tag = @import("std").meta.Tag; +const std = @import("std"); +const expect = std.testing.expect; +const mem = std.mem; +const Tag = std.meta.Tag; test "enum value allocation" { const LargeEnum = enum(u32) { diff --git a/test/behavior/import.zig b/test/behavior/import.zig index e6c3d8111111a8a20b62699a98e32da7572bcc2b..c36aea7d2a9526c4070bd8b7e58a4c1ba4841d97 100644 --- a/test/behavior/import.zig +++ b/test/behavior/import.zig @@ -1,5 +1,6 @@ -const expect = @import("std").testing.expect; -const expectEqual = @import("std").testing.expectEqual; +const std = @import("std"); +const expect = std.testing.expect; +const expectEqual = std.testing.expectEqual; const a_namespace = @import("import/a_namespace.zig"); test "call fn via namespace lookup" { diff --git a/test/behavior/int128.zig b/test/behavior/int128.zig index 12367b2e9c234c4148208eecf5f20651e31d1f72..6bf0eca11ea4cdbae6aba4f92f80a463d3c9b20b 100644 --- a/test/behavior/int128.zig +++ b/test/behavior/int128.zig @@ -2,6 +2,7 @@ const std = @import("std"); const expect = std.testing.expect; const maxInt = std.math.maxInt; const minInt = std.math.minInt; +const builtin = @import("builtin"); test "uint128" { var buff: u128 = maxInt(u128); @@ -21,10 +22,7 @@ test "undefined 128 bit int" { @setRuntimeSafety(true); // TODO implement @setRuntimeSafety in stage2 - if (@import("builtin").zig_is_stage2 and - @import("builtin").mode != .Debug and - @import("builtin").mode != .ReleaseSafe) - { + if (builtin.zig_is_stage2 and builtin.mode != .Debug and builtin.mode != .ReleaseSafe) { return error.SkipZigTest; } diff --git a/test/behavior/ref_var_in_if_after_if_2nd_switch_prong.zig b/test/behavior/ref_var_in_if_after_if_2nd_switch_prong.zig index 488bc1a232c4446792650778cb33c21ad7bb639c..df116c0565e2138ac14bf659d9defbc1edfa7820 100644 --- a/test/behavior/ref_var_in_if_after_if_2nd_switch_prong.zig +++ b/test/behavior/ref_var_in_if_after_if_2nd_switch_prong.zig @@ -1,5 +1,6 @@ -const expect = @import("std").testing.expect; -const mem = @import("std").mem; +const std = @import("std"); +const expect = std.testing.expect; +const mem = std.mem; var ok: bool = false; test "reference a variable in an if after an if in the 2nd switch prong" { diff --git a/test/behavior/reflection.zig b/test/behavior/reflection.zig index e8596c28445a09abd655ef21cdeee0af1e81a65c..18ee9d5c8bddcb2a2c95eb27220b474395b9b477 100644 --- a/test/behavior/reflection.zig +++ b/test/behavior/reflection.zig @@ -1,5 +1,6 @@ -const expect = @import("std").testing.expect; -const mem = @import("std").mem; +const std = @import("std"); +const expect = std.testing.expect; +const mem = std.mem; const reflection = @This(); test "reflection: function return type, var args, and param types" { diff --git a/test/behavior/translate_c_macros.zig b/test/behavior/translate_c_macros.zig index 0baaf24283078e7aebbe65aea490188c02db392f..0e4841020eec1520a8f3dc6cafb718869d76d584 100644 --- a/test/behavior/translate_c_macros.zig +++ b/test/behavior/translate_c_macros.zig @@ -1,5 +1,6 @@ -const expect = @import("std").testing.expect; -const expectEqual = @import("std").testing.expectEqual; +const std = @import("std"); +const expect = std.testing.expect; +const expectEqual = std.testing.expectEqual; const h = @cImport(@cInclude("behavior/translate_c_macros.h")); diff --git a/test/behavior/translate_c_macros_stage1.zig b/test/behavior/translate_c_macros_stage1.zig index 40fbbf52637f6850263f9ba9fac3639c81e289b6..c380508a37b3eee009d5680636d6f72ce6a09fa4 100644 --- a/test/behavior/translate_c_macros_stage1.zig +++ b/test/behavior/translate_c_macros_stage1.zig @@ -1,5 +1,6 @@ -const expect = @import("std").testing.expect; -const expectEqual = @import("std").testing.expectEqual; +const std = @import("std"); +const expect = std.testing.expect; +const expectEqual = std.testing.expectEqual; const h = @cImport(@cInclude("behavior/translate_c_macros.h")); diff --git a/test/behavior/widening.zig b/test/behavior/widening.zig index 3074e96e61770a3dfe795f4e4b1acc11d0f1a6bc..afca1ae1439a2c35a094c71342552b6cbfec8840 100644 --- a/test/behavior/widening.zig +++ b/test/behavior/widening.zig @@ -1,6 +1,7 @@ const std = @import("std"); const expect = std.testing.expect; const mem = std.mem; +const builtin = @import("builtin"); test "integer widening" { var a: u8 = 250; @@ -30,8 +31,8 @@ test "float widening" { test "float widening f16 to f128" { // TODO https://github.com/ziglang/zig/issues/3282 - if (@import("builtin").cpu.arch == .aarch64) return error.SkipZigTest; - if (@import("builtin").cpu.arch == .powerpc64le) return error.SkipZigTest; + if (builtin.cpu.arch == .aarch64) return error.SkipZigTest; + if (builtin.cpu.arch == .powerpc64le) return error.SkipZigTest; var x: f16 = 12.34; var y: f128 = x; diff --git a/test/standalone/install_raw_hex/build.zig b/test/standalone/install_raw_hex/build.zig index 9a0cba7ae831535faddd3bcb58865109bd682bd2..901cff11f04aed52baba679d84521780a859527c 100644 --- a/test/standalone/install_raw_hex/build.zig +++ b/test/standalone/install_raw_hex/build.zig @@ -1,9 +1,8 @@ -const Builder = @import("std").build.Builder; const builtin = @import("builtin"); const std = @import("std"); const CheckFileStep = std.build.CheckFileStep; -pub fn build(b: *Builder) void { +pub fn build(b: *std.build.Builder) void { const target = .{ .cpu_arch = .thumb, .cpu_model = .{ .explicit = &std.Target.arm.cpu.cortex_m4 }, -- 2.54.0