authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-01-07 00:06:06-05:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-01-07 00:06:06-05:00
logc08b190c6918b33d27ceffe1ab3afd5d7f6370ea
tree6dac2ac254e704b2c984f5135c98cd0fd85d4b15
parent7f4fdcc4fce79cc1277c2a89a6a4136293c1b2e5
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

lint: duplicate import (#10519)


29 files changed, 81 insertions(+), 67 deletions(-)

lib/std/hash.zig+7-7
......@@ -33,11 +33,11 @@ const wyhash = @import("hash/wyhash.zig");
3333pub const Wyhash = wyhash.Wyhash;
3434
3535test "hash" {
36 _ = @import("hash/adler.zig");
37 _ = @import("hash/auto_hash.zig");
38 _ = @import("hash/crc.zig");
39 _ = @import("hash/fnv.zig");
40 _ = @import("hash/murmur.zig");
41 _ = @import("hash/cityhash.zig");
42 _ = @import("hash/wyhash.zig");
36 _ = adler;
37 _ = auto_hash;
38 _ = crc;
39 _ = fnv;
40 _ = murmur;
41 _ = cityhash;
42 _ = wyhash;
4343}
lib/std/special/compiler_rt/int.zig+4-3
......@@ -1,8 +1,9 @@
11// Builtin functions that operate on integer types
22const builtin = @import("builtin");
3const testing = @import("std").testing;
4const maxInt = @import("std").math.maxInt;
5const minInt = @import("std").math.minInt;
3const std = @import("std");
4const testing = std.testing;
5const maxInt = std.math.maxInt;
6const minInt = std.math.minInt;
67
78const udivmod = @import("udivmod.zig").udivmod;
89
lib/std/special/compiler_rt/multi3.zig+1-1
......@@ -17,7 +17,7 @@ pub fn __multi3(a: i128, b: i128) callconv(.C) i128 {
1717 return r.all;
1818}
1919
20const v128 = @import("std").meta.Vector(2, u64);
20const v128 = std.meta.Vector(2, u64);
2121pub fn __multi3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 {
2222 return @bitCast(v128, @call(.{ .modifier = .always_inline }, __multi3, .{
2323 @bitCast(i128, a),
lib/std/special/compiler_rt/negsi2_test.zig+3-2
......@@ -1,7 +1,8 @@
1const std = @import("std");
12const neg = @import("negXi2.zig");
2const testing = @import("std").testing;
3const testing = std.testing;
34
4const print = @import("std").debug.print;
5const print = std.debug.print;
56
67fn test__negsi2(a: i32, expected: i32) !void {
78 var result = neg.__negsi2(a);
lib/std/special/compiler_rt/paritydi2_test.zig+3-2
......@@ -1,5 +1,6 @@
1const std = @import("std");
12const parity = @import("parity.zig");
2const testing = @import("std").testing;
3const testing = std.testing;
34
45fn paritydi2Naive(a: i64) i32 {
56 var x = @bitCast(u64, a);
......@@ -25,7 +26,7 @@ test "paritydi2" {
2526 try test__paritydi2(@bitCast(i64, @as(u64, 0xffffffff_fffffffe)));
2627 try test__paritydi2(@bitCast(i64, @as(u64, 0xffffffff_ffffffff)));
2728
28 const RndGen = @import("std").rand.DefaultPrng;
29 const RndGen = std.rand.DefaultPrng;
2930 var rnd = RndGen.init(42);
3031 var i: u32 = 0;
3132 while (i < 10_000) : (i += 1) {
lib/std/special/compiler_rt/paritysi2_test.zig+3-2
......@@ -1,5 +1,6 @@
1const std = @import("std");
12const parity = @import("parity.zig");
2const testing = @import("std").testing;
3const testing = std.testing;
34
45fn paritysi2Naive(a: i32) i32 {
56 var x = @bitCast(u32, a);
......@@ -25,7 +26,7 @@ test "paritysi2" {
2526 try test__paritysi2(@bitCast(i32, @as(u32, 0xfffffffe)));
2627 try test__paritysi2(@bitCast(i32, @as(u32, 0xffffffff)));
2728
28 const RndGen = @import("std").rand.DefaultPrng;
29 const RndGen = std.rand.DefaultPrng;
2930 var rnd = RndGen.init(42);
3031 var i: u32 = 0;
3132 while (i < 10_000) : (i += 1) {
lib/std/special/compiler_rt/parityti2_test.zig+3-2
......@@ -1,5 +1,6 @@
1const std = @import("std");
12const parity = @import("parity.zig");
2const testing = @import("std").testing;
3const testing = std.testing;
34
45fn parityti2Naive(a: i128) i32 {
56 var x = @bitCast(u128, a);
......@@ -25,7 +26,7 @@ test "parityti2" {
2526 try test__parityti2(@bitCast(i128, @as(u128, 0xffffffff_ffffffff_ffffffff_fffffffe)));
2627 try test__parityti2(@bitCast(i128, @as(u128, 0xffffffff_ffffffff_ffffffff_ffffffff)));
2728
28 const RndGen = @import("std").rand.DefaultPrng;
29 const RndGen = std.rand.DefaultPrng;
2930 var rnd = RndGen.init(42);
3031 var i: u32 = 0;
3132 while (i < 10_000) : (i += 1) {
lib/std/special/compiler_rt/popcountdi2_test.zig+3-2
......@@ -1,5 +1,6 @@
1const std = @import("std");
12const popcount = @import("popcount.zig");
2const testing = @import("std").testing;
3const testing = std.testing;
34
45fn popcountdi2Naive(a: i64) i32 {
56 var x = a;
......@@ -24,7 +25,7 @@ test "popcountdi2" {
2425 try test__popcountdi2(@bitCast(i64, @as(u64, 0xffffffff_fffffffe)));
2526 try test__popcountdi2(@bitCast(i64, @as(u64, 0xffffffff_ffffffff)));
2627
27 const RndGen = @import("std").rand.DefaultPrng;
28 const RndGen = std.rand.DefaultPrng;
2829 var rnd = RndGen.init(42);
2930 var i: u32 = 0;
3031 while (i < 10_000) : (i += 1) {
lib/std/special/compiler_rt/popcountsi2_test.zig+3-2
......@@ -1,5 +1,6 @@
1const std = @import("std");
12const popcount = @import("popcount.zig");
2const testing = @import("std").testing;
3const testing = std.testing;
34
45fn popcountsi2Naive(a: i32) i32 {
56 var x = a;
......@@ -24,7 +25,7 @@ test "popcountsi2" {
2425 try test__popcountsi2(@bitCast(i32, @as(u32, 0xfffffffe)));
2526 try test__popcountsi2(@bitCast(i32, @as(u32, 0xffffffff)));
2627
27 const RndGen = @import("std").rand.DefaultPrng;
28 const RndGen = std.rand.DefaultPrng;
2829 var rnd = RndGen.init(42);
2930 var i: u32 = 0;
3031 while (i < 10_000) : (i += 1) {
lib/std/special/compiler_rt/popcountti2_test.zig+3-2
......@@ -1,5 +1,6 @@
1const std = @import("std");
12const popcount = @import("popcount.zig");
2const testing = @import("std").testing;
3const testing = std.testing;
34
45fn popcountti2Naive(a: i128) i32 {
56 var x = a;
......@@ -24,7 +25,7 @@ test "popcountti2" {
2425 try test__popcountti2(@bitCast(i128, @as(u128, 0xffffffff_ffffffff_ffffffff_fffffffe)));
2526 try test__popcountti2(@bitCast(i128, @as(u128, 0xffffffff_ffffffff_ffffffff_ffffffff)));
2627
27 const RndGen = @import("std").rand.DefaultPrng;
28 const RndGen = std.rand.DefaultPrng;
2829 var rnd = RndGen.init(42);
2930 var i: u32 = 0;
3031 while (i < 10_000) : (i += 1) {
lib/std/special/compiler_rt/truncXfYf2_test.zig+3-2
......@@ -1,3 +1,4 @@
1const std = @import("std");
12const __truncsfhf2 = @import("truncXfYf2.zig").__truncsfhf2;
23
34fn test__truncsfhf2(a: u32, expected: u16) !void {
......@@ -217,7 +218,7 @@ fn test__truncdfsf2(a: f64, expected: u32) void {
217218 }
218219 }
219220
220 @import("std").debug.print("got 0x{x} wanted 0x{x}\n", .{ rep, expected });
221 std.debug.print("got 0x{x} wanted 0x{x}\n", .{ rep, expected });
221222
222223 @panic("__trunctfsf2 test failure");
223224}
......@@ -248,7 +249,7 @@ fn test__trunctfhf2(a: f128, expected: u16) void {
248249 return;
249250 }
250251
251 @import("std").debug.print("got 0x{x} wanted 0x{x}\n", .{ rep, expected });
252 std.debug.print("got 0x{x} wanted 0x{x}\n", .{ rep, expected });
252253
253254 @panic("__trunctfhf2 test failure");
254255}
lib/std/special/compiler_rt/udivmod.zig+4-3
......@@ -1,6 +1,7 @@
11const builtin = @import("builtin");
22const is_test = builtin.is_test;
33const native_endian = builtin.cpu.arch.endian();
4const std = @import("std");
45
56const low = switch (native_endian) {
67 .Big => 1,
......@@ -13,9 +14,9 @@ pub fn udivmod(comptime DoubleInt: type, a: DoubleInt, b: DoubleInt, maybe_rem:
1314
1415 const double_int_bits = @typeInfo(DoubleInt).Int.bits;
1516 const single_int_bits = @divExact(double_int_bits, 2);
16 const SingleInt = @import("std").meta.Int(.unsigned, single_int_bits);
17 const SignedDoubleInt = @import("std").meta.Int(.signed, double_int_bits);
18 const Log2SingleInt = @import("std").math.Log2Int(SingleInt);
17 const SingleInt = std.meta.Int(.unsigned, single_int_bits);
18 const SignedDoubleInt = std.meta.Int(.signed, double_int_bits);
19 const Log2SingleInt = std.math.Log2Int(SingleInt);
1920
2021 const n = @ptrCast(*const [2]SingleInt, &a).*; // TODO issue #421
2122 const d = @ptrCast(*const [2]SingleInt, &b).*; // TODO issue #421
lib/std/time.zig+1-1
......@@ -287,5 +287,5 @@ test "Timer" {
287287}
288288
289289test {
290 _ = @import("time/epoch.zig");
290 _ = epoch;
291291}
lib/std/valgrind.zig+2-2
......@@ -258,6 +258,6 @@ pub const memcheck = @import("valgrind/memcheck.zig");
258258pub const callgrind = @import("valgrind/callgrind.zig");
259259
260260test {
261 _ = @import("valgrind/memcheck.zig");
262 _ = @import("valgrind/callgrind.zig");
261 _ = memcheck;
262 _ = callgrind;
263263}
lib/std/zig/system/darwin.zig+1-1
......@@ -88,5 +88,5 @@ pub const DarwinSDK = struct {
8888};
8989
9090test "" {
91 _ = @import("darwin/macos.zig");
91 _ = macos;
9292}
src/Compilation.zig+3-2
......@@ -34,6 +34,7 @@ const ThreadPool = @import("ThreadPool.zig");
3434const WaitGroup = @import("WaitGroup.zig");
3535const libtsan = @import("libtsan.zig");
3636const Zir = @import("Zir.zig");
37const Color = @import("main.zig").Color;
3738
3839/// General-purpose allocator. Used for both temporary and long-term storage.
3940gpa: Allocator,
......@@ -148,7 +149,7 @@ owned_link_dir: ?std.fs.Dir,
148149
149150/// This is for stage1 and should be deleted upon completion of self-hosting.
150151/// Don't use this for anything other than stage1 compatibility.
151color: @import("main.zig").Color = .auto,
152color: Color = .auto,
152153
153154/// This mutex guards all `Compilation` mutable state.
154155mutex: std.Thread.Mutex = .{},
......@@ -790,7 +791,7 @@ pub const InitOptions = struct {
790791 machine_code_model: std.builtin.CodeModel = .default,
791792 clang_preprocessor_mode: ClangPreprocessorMode = .no,
792793 /// This is for stage1 and should be deleted upon completion of self-hosting.
793 color: @import("main.zig").Color = .auto,
794 color: Color = .auto,
794795 test_filter: ?[]const u8 = null,
795796 test_name_prefix: ?[]const u8 = null,
796797 subsystem: ?std.Target.SubSystem = null,
src/mingw.zig+1-1
......@@ -408,7 +408,7 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void {
408408 errdefer comp.gpa.free(lib_final_path);
409409
410410 const llvm = @import("codegen/llvm/bindings.zig");
411 const arch_type = @import("target.zig").archToLLVM(target.cpu.arch);
411 const arch_type = target_util.archToLLVM(target.cpu.arch);
412412 const def_final_path_z = try arena.dupeZ(u8, def_final_path);
413413 const lib_final_path_z = try arena.dupeZ(u8, lib_final_path);
414414 if (llvm.WriteImportLibrary(def_final_path_z.ptr, arch_type, lib_final_path_z.ptr, true)) {
src/tracy.zig+4-3
......@@ -1,9 +1,10 @@
11const std = @import("std");
22const builtin = @import("builtin");
3const build_options = @import("build_options");
34
4pub const enable = if (builtin.is_test) false else @import("build_options").enable_tracy;
5pub const enable_allocation = enable and @import("build_options").enable_tracy_allocation;
6pub const enable_callstack = enable and @import("build_options").enable_tracy_callstack;
5pub const enable = if (builtin.is_test) false else build_options.enable_tracy;
6pub const enable_allocation = enable and build_options.enable_tracy_allocation;
7pub const enable_callstack = enable and build_options.enable_tracy_callstack;
78
89// TODO: make this configurable
910const callstack_depth = 10;
src/translate_c.zig+2-2
......@@ -820,7 +820,7 @@ fn visitVarDecl(c: *Context, var_decl: *const clang.VarDecl, mangled_name: ?[]co
820820 // The C language specification states that variables with static or threadlocal
821821 // storage without an initializer are initialized to a zero value.
822822
823 // @import("std").mem.zeroes(T)
823 // std.mem.zeroes(T)
824824 init_node = try Tag.std_mem_zeroes.create(c.arena, type_node);
825825 }
826826
......@@ -5211,7 +5211,7 @@ const MacroSlicer = struct {
52115211// mapped function exists in `std.zig.c_translation.Macros`
52125212test "Macro matching" {
52135213 const helper = struct {
5214 const MacroFunctions = @import("std").zig.c_translation.Macros;
5214 const MacroFunctions = std.zig.c_translation.Macros;
52155215 fn checkMacro(allocator: mem.Allocator, pattern_list: PatternList, source: []const u8, comptime expected_match: ?[]const u8) !void {
52165216 var tok_list = std.ArrayList(CToken).init(allocator);
52175217 defer tok_list.deinit();
test/behavior/cast.zig+2-4
......@@ -2,6 +2,7 @@ const std = @import("std");
22const expect = std.testing.expect;
33const mem = std.mem;
44const maxInt = std.math.maxInt;
5const builtin = @import("builtin");
56
67test "int to ptr cast" {
78 const x = @as(usize, 13);
......@@ -252,10 +253,7 @@ test "array coersion to undefined at runtime" {
252253 @setRuntimeSafety(true);
253254
254255 // TODO implement @setRuntimeSafety in stage2
255 if (@import("builtin").zig_is_stage2 and
256 @import("builtin").mode != .Debug and
257 @import("builtin").mode != .ReleaseSafe)
258 {
256 if (builtin.zig_is_stage2 and builtin.mode != .Debug and builtin.mode != .ReleaseSafe) {
259257 return error.SkipZigTest;
260258 }
261259
test/behavior/enum_stage1.zig+4-3
......@@ -1,6 +1,7 @@
1const expect = @import("std").testing.expect;
2const mem = @import("std").mem;
3const Tag = @import("std").meta.Tag;
1const std = @import("std");
2const expect = std.testing.expect;
3const mem = std.mem;
4const Tag = std.meta.Tag;
45
56test "enum value allocation" {
67 const LargeEnum = enum(u32) {
test/behavior/import.zig+3-2
......@@ -1,5 +1,6 @@
1const expect = @import("std").testing.expect;
2const expectEqual = @import("std").testing.expectEqual;
1const std = @import("std");
2const expect = std.testing.expect;
3const expectEqual = std.testing.expectEqual;
34const a_namespace = @import("import/a_namespace.zig");
45
56test "call fn via namespace lookup" {
test/behavior/int128.zig+2-4
......@@ -2,6 +2,7 @@ const std = @import("std");
22const expect = std.testing.expect;
33const maxInt = std.math.maxInt;
44const minInt = std.math.minInt;
5const builtin = @import("builtin");
56
67test "uint128" {
78 var buff: u128 = maxInt(u128);
......@@ -21,10 +22,7 @@ test "undefined 128 bit int" {
2122 @setRuntimeSafety(true);
2223
2324 // TODO implement @setRuntimeSafety in stage2
24 if (@import("builtin").zig_is_stage2 and
25 @import("builtin").mode != .Debug and
26 @import("builtin").mode != .ReleaseSafe)
27 {
25 if (builtin.zig_is_stage2 and builtin.mode != .Debug and builtin.mode != .ReleaseSafe) {
2826 return error.SkipZigTest;
2927 }
3028
test/behavior/ref_var_in_if_after_if_2nd_switch_prong.zig+3-2
......@@ -1,5 +1,6 @@
1const expect = @import("std").testing.expect;
2const mem = @import("std").mem;
1const std = @import("std");
2const expect = std.testing.expect;
3const mem = std.mem;
34
45var ok: bool = false;
56test "reference a variable in an if after an if in the 2nd switch prong" {
test/behavior/reflection.zig+3-2
......@@ -1,5 +1,6 @@
1const expect = @import("std").testing.expect;
2const mem = @import("std").mem;
1const std = @import("std");
2const expect = std.testing.expect;
3const mem = std.mem;
34const reflection = @This();
45
56test "reflection: function return type, var args, and param types" {
test/behavior/translate_c_macros.zig+3-2
......@@ -1,5 +1,6 @@
1const expect = @import("std").testing.expect;
2const expectEqual = @import("std").testing.expectEqual;
1const std = @import("std");
2const expect = std.testing.expect;
3const expectEqual = std.testing.expectEqual;
34
45const h = @cImport(@cInclude("behavior/translate_c_macros.h"));
56
test/behavior/translate_c_macros_stage1.zig+3-2
......@@ -1,5 +1,6 @@
1const expect = @import("std").testing.expect;
2const expectEqual = @import("std").testing.expectEqual;
1const std = @import("std");
2const expect = std.testing.expect;
3const expectEqual = std.testing.expectEqual;
34
45const h = @cImport(@cInclude("behavior/translate_c_macros.h"));
56
test/behavior/widening.zig+3-2
......@@ -1,6 +1,7 @@
11const std = @import("std");
22const expect = std.testing.expect;
33const mem = std.mem;
4const builtin = @import("builtin");
45
56test "integer widening" {
67 var a: u8 = 250;
......@@ -30,8 +31,8 @@ test "float widening" {
3031
3132test "float widening f16 to f128" {
3233 // TODO https://github.com/ziglang/zig/issues/3282
33 if (@import("builtin").cpu.arch == .aarch64) return error.SkipZigTest;
34 if (@import("builtin").cpu.arch == .powerpc64le) return error.SkipZigTest;
34 if (builtin.cpu.arch == .aarch64) return error.SkipZigTest;
35 if (builtin.cpu.arch == .powerpc64le) return error.SkipZigTest;
3536
3637 var x: f16 = 12.34;
3738 var y: f128 = x;
test/standalone/install_raw_hex/build.zig+1-2
......@@ -1,9 +1,8 @@
1const Builder = @import("std").build.Builder;
21const builtin = @import("builtin");
32const std = @import("std");
43const CheckFileStep = std.build.CheckFileStep;
54
6pub fn build(b: *Builder) void {
5pub fn build(b: *std.build.Builder) void {
76 const target = .{
87 .cpu_arch = .thumb,
98 .cpu_model = .{ .explicit = &std.Target.arm.cpu.cortex_m4 },