#std.builtin bug? .Int is not a Type?

1 messages · Page 1 of 1 (latest)

glad matrix
#

I think I found a bug.
When running a test, I'm getting the following error:

src/constants.zig:23:4: error: no field named 'Int' in union 'builtin.Type'
  .Int = .{
   ^~~
/home/komeiji/.local/bin/lib/std/builtin.zig:563:18: note: union declared here
pub const Type = union(enum) {
                 ^~~~~

If I inspect the builtin.zig file, I see that .Int is clearly defined under builtin.Type.
Code in question:

pub const halfRsaOutBits = @Type(std.builtin.Type{
  .Int = .{
    .singedness = .unsigned,
    .bits = (256 * 8) / 2,
  }
});

pub const rsaOutBits = @Type(std.builtin.Type{
  .Int = .{
    .singedness = .unsigned,
    .bits = (256 * 8),
  }
});

pub const doubleRsaOutBits = @Type(std.builtin.Type{ .Int = .{
    .singedness = .unsigned,
    .bits = (256 * 16),
  }
});

Zig version: 0.14.0
Confirmed on Windows, Linux, and OpenBSD.

glad matrix
#

Ah, that explains why.

spark turret
#

Fyi another breaking change is on the horizon regarding @Type

#

In short instead of

pub const halfRsaOutBits = @Type(std.builtin.Type{
  .Int = .{
    .singedness = .unsigned,
    .bits = (256 * 8) / 2,
  }
});

Which you can infer the Type by the way

pub const halfRsaOutBits = @Type(.{
  .Int = .{
    .singedness = .unsigned,
    .bits = (256 * 8) / 2,
  }
});

You'd do something like this:

pub const halfRsaOutBits = @Int(.unsigned, (256 * 8) / 2);
glad matrix
#

So basically, it'll get shortened.

spark turret
#

Which is superior imo