std: fix compile errors found by stage2

* redundant `comptime`
 * `try` outside function
 * `extern enum`
This commit is contained in:
Andrew Kelley
2021-05-05 11:03:54 -07:00
parent fc40d23723
commit 6b5d0b3711
4 changed files with 6 additions and 6 deletions

View File

@@ -43,7 +43,7 @@ pub fn Field(comptime params: FieldParams) type {
pub const zero: Fe = Fe{ .limbs = mem.zeroes(Limbs) };
/// One.
pub const one = comptime one: {
pub const one = one: {
var fe: Fe = undefined;
fiat.setOne(&fe.limbs);
break :one fe;

View File

@@ -30,8 +30,8 @@ pub const P256 = struct {
/// The P256 base point.
pub const basePoint = P256{
.x = try Fe.fromInt(48439561293906451759052585252797914202762949526041747995844080717082404635286),
.y = try Fe.fromInt(36134250956749795798585127919587881956611106672985015071877198253568414405109),
.x = Fe.fromInt(48439561293906451759052585252797914202762949526041747995844080717082404635286) catch unreachable,
.y = Fe.fromInt(36134250956749795798585127919587881956611106672985015071877198253568414405109) catch unreachable,
.z = Fe.one,
.is_base = true,
};
@@ -39,7 +39,7 @@ pub const P256 = struct {
/// The P256 neutral element.
pub const identityElement = P256{ .x = Fe.zero, .y = Fe.one, .z = Fe.zero };
pub const B = try Fe.fromInt(41058363725152142129326129780047268409114441015993725554835256314039467401291);
pub const B = Fe.fromInt(41058363725152142129326129780047268409114441015993725554835256314039467401291) catch unreachable;
/// Reject the neutral element.
pub fn rejectIdentity(p: P256) IdentityElementError!void {

View File

@@ -49,7 +49,7 @@ pub const Connection = struct {
};
/// Possible domains that a TCP client/listener may operate over.
pub const Domain = extern enum(u16) {
pub const Domain = enum(u16) {
ip = os.AF_INET,
ipv6 = os.AF_INET6,
};

View File

@@ -343,7 +343,7 @@ pub const IPv6 = extern struct {
opts: fmt.FormatOptions,
writer: anytype,
) !void {
comptime const specifier = &[_]u8{if (layout.len == 0) 'x' else switch (layout[0]) {
const specifier = comptime &[_]u8{if (layout.len == 0) 'x' else switch (layout[0]) {
'x', 'X' => |specifier| specifier,
's' => 'x',
'S' => 'X',