aboutsummaryrefslogtreecommitdiff
path: root/lib/std/builtin.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-03-06 18:30:30 -0500
committerAndrew Kelley <andrew@ziglang.org>2020-03-06 18:30:30 -0500
commitfa46bcb36864e6616ce4449965063f3b8720f8e1 (patch)
treed0f486600d651e47609ac57bed117422791930bc /lib/std/builtin.zig
parent83d27f71ef92d555cc15645bf9d948203ba8af1e (diff)
downloadzig-fa46bcb36864e6616ce4449965063f3b8720f8e1.tar.gz
zig-fa46bcb36864e6616ce4449965063f3b8720f8e1.zip
stage1: make get_optional_type more robust
Now it will emit a compile error rather than crashing when the child type has not been resolved properly. Introduces `get_optional_type2` which should be used generally inside ir.cpp. Fix some std lib compile errors noticed by the provided test case. Thanks @LemonBoy for the test case. Closes #4377. Fixes #4374.
Diffstat (limited to 'lib/std/builtin.zig')
-rw-r--r--lib/std/builtin.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig
index a4f0ef269f..fa5b49db37 100644
--- a/lib/std/builtin.zig
+++ b/lib/std/builtin.zig
@@ -27,7 +27,7 @@ pub const Cpu = std.Target.Cpu;
/// On non-Windows targets, this is `null`.
pub const subsystem: ?SubSystem = blk: {
if (@hasDecl(@This(), "explicit_subsystem")) break :blk explicit_subsystem;
- switch (os) {
+ switch (os.tag) {
.windows => {
if (is_test) {
break :blk SubSystem.Console;
@@ -406,9 +406,9 @@ pub const Version = struct {
min: Version,
max: Version,
- pub fn includesVersion(self: LinuxVersionRange, ver: Version) bool {
- if (self.min.compare(ver) == .gt) return false;
- if (self.max.compare(ver) == .lt) return false;
+ pub fn includesVersion(self: Range, ver: Version) bool {
+ if (self.min.order(ver) == .gt) return false;
+ if (self.max.order(ver) == .lt) return false;
return true;
}
};