Commit 6b5d0b3711

Andrew Kelley <andrew@ziglang.org>
2021-05-05 20:03:54
std: fix compile errors found by stage2
* redundant `comptime` * `try` outside function * `extern enum`
1 parent fc40d23
Changed files (4)
lib
std
crypto
x
lib/std/crypto/pcurves/common.zig
@@ -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;
lib/std/crypto/pcurves/p256.zig
@@ -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 {
lib/std/x/net/tcp.zig
@@ -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,
 };
lib/std/x/os/net.zig
@@ -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',