diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-03-11 11:24:01 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-03-11 11:25:45 +0200 |
| commit | 98a5998d831fd0fa7b897aafacf4c2af18e64ed1 (patch) | |
| tree | 04846185bf4314afe9c942a7e72e13ae76ae51cd /lib/std | |
| parent | 078037ab9b410fa13a86eabdfc30918fc83cdcf3 (diff) | |
| download | zig-98a5998d831fd0fa7b897aafacf4c2af18e64ed1.tar.gz zig-98a5998d831fd0fa7b897aafacf4c2af18e64ed1.zip | |
Sema: improve detection of generic parameters
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/rand.zig | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/std/rand.zig b/lib/std/rand.zig index 53b536f9ff..cfac15a1fb 100644 --- a/lib/std/rand.zig +++ b/lib/std/rand.zig @@ -7,6 +7,7 @@ //! TODO(tiehuis): Benchmark these against other reference implementations. const std = @import("std.zig"); +const builtin = @import("builtin"); const assert = std.debug.assert; const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; @@ -30,7 +31,10 @@ pub const Sfc64 = @import("rand/Sfc64.zig"); pub const Random = struct { ptr: *anyopaque, - fillFn: fn (ptr: *anyopaque, buf: []u8) void, + fillFn: if (builtin.zig_backend == .stage1) + fn (ptr: *anyopaque, buf: []u8) void + else + *const fn (ptr: *anyopaque, buf: []u8) void, pub fn init(pointer: anytype, comptime fillFn: fn (ptr: @TypeOf(pointer), buf: []u8) void) Random { const Ptr = @TypeOf(pointer); |
