aboutsummaryrefslogtreecommitdiff
path: root/lib/std/SemanticVersion.zig
AgeCommit message (Collapse)Author
2025-08-29std.Io: delete GenericReaderAndrew Kelley
and delete deprecated alias std.io
2025-07-07std.fmt: fully remove format string from format methodsAndrew Kelley
Introduces `std.fmt.alt` which is a helper for calling alternate format methods besides one named "format".
2025-07-07std.fmt: breaking API changesAndrew Kelley
added adapter to AnyWriter and GenericWriter to help bridge the gap between old and new API make std.testing.expectFmt work at compile-time std.fmt no longer has a dependency on std.unicode. Formatted printing was never properly unicode-aware. Now it no longer pretends to be. Breakage/deprecations: * std.fs.File.reader -> std.fs.File.deprecatedReader * std.fs.File.writer -> std.fs.File.deprecatedWriter * std.io.GenericReader -> std.io.Reader * std.io.GenericWriter -> std.io.Writer * std.io.AnyReader -> std.io.Reader * std.io.AnyWriter -> std.io.Writer * std.fmt.format -> std.fmt.deprecatedFormat * std.fmt.fmtSliceEscapeLower -> std.ascii.hexEscape * std.fmt.fmtSliceEscapeUpper -> std.ascii.hexEscape * std.fmt.fmtSliceHexLower -> {x} * std.fmt.fmtSliceHexUpper -> {X} * std.fmt.fmtIntSizeDec -> {B} * std.fmt.fmtIntSizeBin -> {Bi} * std.fmt.fmtDuration -> {D} * std.fmt.fmtDurationSigned -> {D} * {} -> {f} when there is a format method * format method signature - anytype -> *std.io.Writer - inferred error set -> error{WriteFailed} - options -> (deleted) * std.fmt.Formatted - now takes context type explicitly - no fmt string
2024-10-31compiler: remove anonymous struct types, unify all tuplesmlugg
This commit reworks how anonymous struct literals and tuples work. Previously, an untyped anonymous struct literal (e.g. `const x = .{ .a = 123 }`) was given an "anonymous struct type", which is a special kind of struct which coerces using structural equivalence. This mechanism was a holdover from before we used RLS / result types as the primary mechanism of type inference. This commit changes the language so that the type assigned here is a "normal" struct type. It uses a form of equivalence based on the AST node and the type's structure, much like a reified (`@Type`) type. Additionally, tuples have been simplified. The distinction between "simple" and "complex" tuple types is eliminated. All tuples, even those explicitly declared using `struct { ... }` syntax, use structural equivalence, and do not undergo staged type resolution. Tuples are very restricted: they cannot have non-`auto` layouts, cannot have aligned fields, and cannot have default values with the exception of `comptime` fields. Tuples currently do not have optimized layout, but this can be changed in the future. This change simplifies the language, and fixes some problematic coercions through pointers which led to unintuitive behavior. Resolves: #16865
2024-02-26Change many test blocks to doctests/decltestsRyan Liptak
2024-02-26Remove redundant test name prefixes now that test names are fully qualifiedRyan Liptak
Follow up to #19079, which made test names fully qualified. This fixes tests that now-redundant information in their test names. For example here's a fully qualified test name before the changes in this commit: "priority_queue.test.std.PriorityQueue: shrinkAndFree" and the same test's name after the changes in this commit: "priority_queue.test.shrinkAndFree"
2023-10-23std.zig.system.NativeTargetInfo: fix glibc version parsingEric Joldasov
In most cases "GLIBC_2.X" strings and `/lib/libc-2.x.so` files do not contain third (`patch`) field, which causes std.SemanticVersion.parse function to return error. To fix this, we reuse [now-public] std.zig.CrossTarget.parseVersion function, which accounts for this third field and makes it 0 in case it was not found. This new behaviour is similar to std.builtin.Version.parse, which was removed in https://github.com/ziglang/zig/commit/6e84f469904a24615a6721265a88ad8dcb4ed83a Fixes regression from https://github.com/ziglang/zig/commit/6e84f469904a24615a6721265a88ad8dcb4ed83a and https://github.com/ziglang/zig/pull/13998 . Related: https://github.com/ziglang/zig/issues/17626 . Results with `zig end`: Before: `"target": "x86_64-linux.6.5.7...6.5.7-gnu.2.19",` After: `"target": "x86_64-linux.6.5.7...6.5.7-gnu.2.36",` Also, while we are here, write explicit error sets and remove duplicate logic from std.zig.system.darwin.macos.parseSystemVersion . Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-17std: replace builtin.Version with SemanticVersionr00ster91
2023-05-13Update all std.mem.split calls to their appropriate functionRyan Liptak
Everywhere that can now use `splitScalar` should get a nice little performance boost.
2022-12-09api(std.ascii): remove deprecated declsr00ster91
2022-11-12Make invalidFmtError public and use in place of compileErrors for bad format ↵Nick Cernis
strings (#13526) * Export invalidFmtErr To allow consistent use of "invalid format string" compile error response for badly formatted format strings. See https://github.com/ziglang/zig/pull/13489#issuecomment-1311759340. * Replace format compile errors with invalidFmtErr - Provides more consistent compile errors. - Gives user info about the type of the badly formated value. * Rename invalidFmtErr as invalidFmtError For consistency. Zig seems to use “Error” more often than “Err”. * std: add invalid format string checks to remaining custom formatters * pass reference-trace to comp when building build file; fix checkobjectstep
2022-07-25std.mem: add `first` method to `SplitIterator` and `SplitBackwardsIterator`r00ster
2021-08-24remove redundant license headers from zig standard libraryAndrew Kelley
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
2021-08-06Update all usages of mem.split/mem.tokenize for generic versionRyan Liptak
2021-06-21fix code broken from previous commitJacob G-W
2021-05-08std: update usage of std.testingVeikka Tuominen
2021-01-12Move fmt.testFmt to testing.expectFmtJay Petacat
2021-01-09builtin: Add zig_versionJay Petacat
This will enable code to perform version checks and make it easier to support multiple versions of Zig. Within the SemVer implementation, an intermediate value needed to be coerced to a slice to workaround a comptime bug. Closes #6466
2021-01-02convert more {} to {d} and {s}Andrew Kelley
2021-01-02std: Use {s} instead of {} when printing stringsLemonBoy
2020-11-06std: Introduce SemanticVersion data structureJay Petacat
This will parse, format, and compare version strings following the SemVer 2 specification. See: https://semver.org Updates #6466