Commit Graph

129 Commits

Author SHA1 Message Date
Andrew Kelley 5619ce2406 Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen
Conflicts:
 * doc/langref.html.in
 * lib/std/enums.zig
 * lib/std/fmt.zig
 * lib/std/hash/auto_hash.zig
 * lib/std/math.zig
 * lib/std/mem.zig
 * lib/std/meta.zig
 * test/behavior/alignof.zig
 * test/behavior/bitcast.zig
 * test/behavior/bugs/1421.zig
 * test/behavior/cast.zig
 * test/behavior/ptrcast.zig
 * test/behavior/type_info.zig
 * test/behavior/vector.zig

Master branch added `try` to a bunch of testing function calls, and some
lines also had changed how to refer to the native architecture and other
`@import("builtin")` stuff.
2021-05-08 14:45:21 -07:00
Veikka Tuominen fd77f2cfed std: update usage of std.testing 2021-05-08 15:15:30 +03:00
Andrew Kelley c60d8f017e std: remove redundant comptime keyword
@g-w1's fancy new compile error in action
2021-04-28 22:58:12 -07:00
Edward Dean 83a2665772 Fixed error types for GetSeekPosError 2021-04-04 17:04:46 -07:00
Sébastien Marie 89e522b935 make std.c.getErrno() return same type as _errno() aka c_int
adjust std.os.unexpectedErrno() to be correct for all std.os.system.errno (c_int, u12, usize, ...)
2021-03-12 15:04:36 +01:00
daurnimator 34ca6b7b44 std: add io.Writer.writeStruct
We have readStruct, add writeStruct for symmetry
2021-03-03 22:45:45 +01:00
Andrew Kelley 8e6c2b7a47 Merge remote-tracking branch 'origin/master' into ast-memory-layout 2021-02-24 15:08:23 -07:00
Benjamin Graf c70832bc41 replace ArrayList.shrinkAndFree by ArrayList.shrinkRetainingCapacity 2021-02-21 11:56:14 +02:00
Isaac Freund 070e548acf std: remove io.AutoIndentingStream
This type is not widely applicable enough to be a public part of the
public interface of the std.

The current implementation in only fully utilized by the zig fmt
implementation, which could benefit by even tighter integration as
will be demonstrated in the next commit. Therefore, move the current
io.AutoIndentingStream to lib/std/zig/render.zig.

The C backend of the self hosted compiler also use this type currently,
but it does not require anywhere near its full complexity. Therefore,
implement a greatly simplified version of this interface in
src/codegen/c.zig.
2021-02-16 23:20:46 +01:00
LemonBoy 134f5fd3d6 std: Update test "" to test where it makes sense 2021-01-22 15:46:58 +01:00
Andrew Kelley d68adc5382 std.EarlyEOFReader: rename to LimitedReader 2021-01-11 16:51:56 -07:00
daurnimator e873668d38 std: add LimitedReader: reader that returns EOF early 2021-01-11 16:48:30 -07:00
daurnimator 0ab8ae944c std: reader.skipBytes's num_bytes should be a u64 2021-01-11 16:47:48 -07:00
Jay Petacat e72472d953 io: FindByteOutStream to FindByteWriter
See #4917
2021-01-08 16:54:56 -05:00
Jay Petacat 1595ce273e Remove deprecated stream aliases 2021-01-08 16:54:56 -05:00
Jay Petacat a9b505fa77 Reduce use of deprecated IO types
Related: #4917
2021-01-07 23:48:58 -08:00
Alex Cameron 89286376c6 std: Rename ArrayList shrink => shrinkAndFree 2021-01-06 00:55:51 +11:00
LemonBoy dd973fb365 std: Use {s} instead of {} when printing strings 2021-01-02 17:12:57 -07:00
Frank Denis 6c2e0c2046 Year++ 2020-12-31 15:45:24 -08:00
Isaac Freund 3634d44d08 std: fix Reader.readUntilDelimiterOrEofAlloc() API
The current API does not allow the user to distinguish between EOF and
an empty line. Reader.readUntilDelimiterOrEof() gets this API right so
update readUntilDelimiterOrEofAlloc() to match it. Returning an optional
here additionally makes calling this in a loop much cleaner.

Remove readUntilDelimiterOrEofArrayList() as it no longer needed to
implement readUntilDelimiterOrEof() and has the same API issues
described without a clear way to fix them.
2020-12-29 19:09:36 -08:00
Veikka Tuominen e79acc24d3 std: clenup, fixes, fmt 2020-12-24 00:23:29 +02:00
tgschultz ab6183e119 Added std.io.counting_reader 2020-12-23 01:27:12 +02:00
Andrew Kelley 4964bb3282 std: move serialization to the std lib orphanage
std-lib-orphanage commit 633792839f6f838fa864cde6af015413ee713404
2020-12-20 15:08:06 -07:00
Lee Cannon f598245836 Make zig fmt happy with multiline arguments for readAllArrayListAligned 2020-12-03 10:24:49 +00:00
Lee Cannon 76f3921544 Add readUntilDelimiterOrEofArrayList & readUntilDelimiterOrEofAlloc 2020-12-02 12:55:54 +00:00
christian-stephen abc729a5f9 Add readAllArrayListAligned to Reader which can accept an arbitrary alignment 2020-11-27 17:00:50 -08:00
Tadeo Kondrak 25ec2dbc1e Add builtin.Signedness, use it instead of is_signed 2020-11-19 18:59:21 +02:00
Veikka Tuominen 6d5b76a75d Merge pull request #7005 from jshholland/deprecate-span
Remove ArrayList.span
2020-11-18 13:14:48 +02:00
Josh Holland c25b157dda remove deprecated uses of ArrayList.span 2020-11-07 11:15:44 +00:00
xackus 5c8f7f81cd change debug.assert to testing.expect in tests 2020-11-06 22:48:54 +01:00
LemonBoy dc872a221d std: Fix syscall stubs passing 64bit offsets for BE targets 2020-11-02 12:11:07 +01:00
Frank Denis 74a1175d9d std/*: add missing MIT license headers 2020-10-26 17:41:29 +01:00
Jan Prudil aadccc4206 Make std.meta.Int accept a signedness parameter 2020-10-17 14:09:59 +02:00
Tadeo Kondrak 771f35c593 Use less inefficient method of replacing TypeInfo.UnionField.enum_field 2020-09-07 06:23:27 -06:00
Tadeo Kondrak ac19ccf595 Update standard library for removal of TypeInfo.UnionField.enum_field 2020-09-07 06:23:26 -06:00
Vexu 1df0f3ac24 update uses of deprecated type field access 2020-09-03 18:10:40 +03:00
Lachlan Easton bb848dbeee zig fmt: Patch rename stream to ais (auto indenting stream) & other small refactors 2020-09-02 20:16:28 +10:00
Lachlan Easton bc24b86d82 zig fmt: Fix regression not covered by testing 2020-09-01 13:19:34 +10:00
Lachlan Easton 029ec456bc zig fmt: Set indent_delta to 2 when rendering inline asm 2020-08-31 23:39:50 +10:00
Lachlan Easton 5aca3baea6 zig fmt: Remove dynamic stack from auto-indenting-stream 2020-08-31 23:39:50 +10:00
Lachlan Easton 50c8a53188 Use ArrayList instead of fixed array for auto_indenting_stream 2020-08-30 10:32:21 +10:00
Lachlan Easton 7d950210a6 zig fmt review comments 2020-08-30 10:28:17 +10:00
Lachlan Easton a72b9d403d Refactor zig fmt indentation. Remove indent from rendering code and have a stream handle automatic indentation 2020-08-29 13:35:00 +10:00
joachimschmidt557 3750cc06fd Improve io.Reader.skipBytes and add tests 2020-08-28 19:42:36 +02:00
Andrew Kelley 4a69b11e74 add license header to all std lib files
add SPDX license identifier
copyright ownership is zig contributors
2020-08-20 16:07:04 -04:00
Vexu be1507a7af update compile error tests and some doc comments 2020-07-12 00:54:07 +03:00
Vexu e85fe13e44 run zig fmt on std lib and self hosted 2020-07-11 20:41:19 +03:00
Jakub Konka 923c0feda1 Add std.fs.File.readAllAlloc tests
This commit adds some unit tests for `std.fs.File.readAllAlloc`
function. It also updates the docs of `Reader.readNoEof`
which were outdated, and swaps `inStream()` for  `reader()` in
`File.readAllAlloc` with the former being deprecated.
2020-06-22 20:03:21 -04:00
Andrew Kelley da549a72e1 zig fmt 2020-06-20 18:39:15 -04:00
Jonathan Marler a282ac7a91 Support Reader for InStream 2020-06-09 13:36:17 -04:00