Commit Graph

8445 Commits

Author SHA1 Message Date
Ryan Liptak
89ea67aee2 Disable flaky part of Dir.rename directories test on Windows
See https://github.com/ziglang/zig/issues/17134
2023-09-13 03:46:00 -04:00
Lucas Culverhouse
5b7eefce46
std.math.cbrt: fixed -0.0 evaluating to 0.0 2023-09-12 18:39:34 +00:00
Ruben Dimas
402468b210 std.math.asinh: changed unsigned int to hexadecimal 2023-09-12 22:22:07 +12:00
Ruben Dimas
a8a4f1755e std.math.asinh: fixed -0.0 evaluating to 0.0 2023-09-12 22:22:07 +12:00
Techatrix
7827265ea8
json: respect max_value_len when parsing std.json.Value (#17107) 2023-09-11 17:00:06 -04:00
Ian Johnson
d2014fe971 Autodoc: simplify search text on mobile
This prevents the placeholder text from spilling out of the search bar
on smaller screens.
2023-09-09 19:48:18 +02:00
Ian Johnson
51d7700c8c Autodoc: tweak page layout
Closes #17011
Closes #17012

This commit allows the logo to scale more freely to fit its container,
and removes some extra margins so that the content scroll bar is flush
with the right side of the viewport.
2023-09-09 19:48:18 +02:00
Ian Johnson
2f26b15995 Autodoc: fix search results navigation
Closes #17013
2023-09-09 19:47:57 +02:00
Wooster
f33bb0228b
std: clean up top-level namespaces documentation
This cleans up existing documentation, adds a bit more, and fixes some
typos too.
2023-09-08 21:59:25 +03:00
none
39a98dc426 std.tar: add support for file path in pax attributes
Handles .extended_header type to parse PAX attributes and check if they override
the path of the next file. Increases file path limit to std.fs.MAX_PATH_BYTES.

Fixes #15342
2023-09-08 21:55:14 +03:00
xdBronch
fa46750a84 remove outdated error message in std.fs 2023-09-08 21:47:44 +03:00
Linus Groh
c097209792 std.c.linux: Add getpw{nam,uid}() 2023-09-08 21:46:05 +03:00
Pascal S. de Kloe
9126852ba9 mem: explicit dupe and dupeZ error on Allocator 2023-09-07 21:56:57 +03:00
Gregory Anders
cab9da35bd std: enable FailingAllocator to fail on resize
Now that allocator.resize() is allowed to fail, programs may wish to
test code paths that handle resize() failure. The simplest way to do
this now is to replace the vtable of the testing allocator with one
that uses Allocator.noResize for the 'resize' function pointer.

An alternative way to support this testing capability is to augment the
FailingAllocator (which is already useful for testing allocation failure
scenarios) to intentionally fail on calls to resize(). To do this, add a
'resize_fail_index' parameter to the FailingAllocator that causes
resize() to fail after the given number of calls.
2023-09-06 19:06:32 +03:00
Luis Cáceres
8976ad7ecb std.net: Fix IPv6 address parsing for single digit
This fixes the case where IPv6 address parsing incorrectly succeeded on
input such as `1`, which now returns error.Incomplete.
2023-09-06 11:14:24 +03:00
Loris Cro
fda087ed81 autodoc: style links in source code 2023-09-04 18:56:45 +02:00
Jakub Konka
0e8f130aed
Merge pull request #16977 from kcbanner/lib_getauxval_fixup
linux: export getauxval when not compiling with libc
2023-09-04 09:11:15 +02:00
Jim Calabro
ec5a068ac1
Make a Couple Syscall Comments Consistent (#17066)
* Make a Couple Syscall Comments Consistent

* linux.diet.net -> man7.org
2023-09-04 09:09:11 +02:00
Krzysztof Wolicki
5cc1831ca4
autodoc: Fix rendering of enum types (#17058) 2023-09-03 18:34:29 +02:00
Loris Cro
e5c72a32a7 autodoc: fix rendering of std.json.ObjectMap
closes #17014
supersedes #17022
follow up issue #17061
2023-09-03 18:32:26 +02:00
Krzysztof Wolicki
555028086a
autodoc: Implement @call, @unionInit, @mulAdd support (#16918)
* autodoc: Implement `@call`, `@unionInit`, `@mulAdd` support

* autodoc: Implement builtinIndex in ex
2023-09-03 17:20:23 +02:00
Krzysztof Wolicki
86a9e1deaf
autodoc: Implement @bitSizeOf rendering in main.js (#16895) 2023-09-03 17:18:51 +02:00
Krzysztof Wolicki
80c1d48ccb
autodoc: Implement a[b], a.?, and a.* (#16863)
* autodoc: Implement elem_val_node and basic optional_payload_*

* autodoc: Add `.*` loads
2023-09-03 17:18:16 +02:00
Loris Cro
0516a4d629 autodoc: fix typo 2023-09-03 17:15:15 +02:00
Loris Cro
c0da41582b autodoc: better light mode colors
fix #15799
2023-09-03 17:12:52 +02:00
James Chen-Smith
c3a8f1fe92
autodoc: Extract decl ref style and fix light mode color (#15990)
Co-authored-by: James Chen-Smith <james@chen-smith.net>
Co-authored-by: Loris Cro <kappaloris@gmail.com>
2023-09-03 16:51:07 +02:00
Ambareesh "Amby" Balaji
62f727eedb std.fs: Fix typo in accessAbsoluteW 2023-09-03 12:03:14 +02:00
Jan Philipp Hafer
1816bb4ab0 std.os+windows: isAtLeast(.win10_rs5) in renameatW(), DeleteFile() for posix semantics
Usage of FILE_RENAME_IGNORE_READONLY_ATTRIBUTE or
FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE for posix semantics require
win10_rs5 instead of win10_rs1 necessary for posix semantics. Keep it as simple
as possible, since it is reasonable to expect users being able to update
win10_rs5 or use non-posix semantics instead.

Closes #17049.
2023-09-03 08:35:26 +02:00
Josh Wolfe
8b74eae9c6
std.ArrayHashMap.reIndex also recomputes hashes (#17054) 2023-09-02 17:00:20 -04:00
Michal Ziulek
bb2eb44430 std.coff: Fixed compile error. 2023-09-02 00:18:53 +02:00
Ryan Liptak
01f9cdd21a Temporarily disable Dir.statFile test when linking glibc
See https://github.com/ziglang/zig/issues/17034
2023-08-31 18:01:15 -07:00
Ryan Liptak
f46008c1d8 Fix Dir.statFile for WASI when linking libc
`statFile` now only uses `os.fstatatWasi` when not linking libc, matching the pattern used throughout other `Dir` functions. This fixes the compilation error: `error: struct 'c.wasi.Stat' has no member named 'fromFilestat'` (which the added test would have failed with)
2023-08-31 14:07:15 -07:00
Igor Sadikov
4635179857 Optimize std.base64.standard.Encoder.encode 2023-08-29 16:00:31 -04:00
Jakub Konka
3b2b9fcbc5 darwin: move inference of SDK version into the linker
`std.zig.system.darwin.getSdk` now pulls only the SDK path
so we execute a child process only once and not twice as it was
until now since we parse the SDK version directly from the pulled path.
This is actually how `ld64` does it too.
2023-08-29 06:43:41 +02:00
Jay Petacat
26b03ca823 std: Move TailQueue alias to correct namespace
This fixes a mistake in PR #16996.
2023-08-28 17:41:37 -07:00
Jay Petacat
ff61c42879 std: Rename TailQueue to DoublyLinkedList
`TailQueue` was implemented as a doubly-linked list, but named after an
abstract data type. This was inconsistent with `SinglyLinkedList`, which
can be used to implement an abstract data type, but is still named after
the implementation. Renaming `TailQueue` to `DoublyLinkedList` improves
consistency between the two type names, and should help discoverability.

`TailQueue` is now a deprecated alias of `DoublyLinkedList`.

Related to issues #1629 and #8233.
2023-08-27 20:57:46 -07:00
kcbanner
2e2d6d2c3d linux: fixup for platforms that don't support extern functions yet 2023-08-27 19:50:57 -04:00
kcbanner
fb0cef8522 linux: only export getauxval if not linking libc 2023-08-27 16:52:43 -04:00
kcbanner
fba81cd606 linux: instead of export elf_aux_maybe, export getauxval itself 2023-08-27 11:12:31 -04:00
kcbanner
731c6d3fbb linux: export elf_aux_maybe so that libraries can call getauxval 2023-08-26 17:55:12 -04:00
Jacob Young
750998eef6 Build: fail tests that log errors, like zig test does 2023-08-25 15:36:25 -07:00
xdBronch
4403008cab
fix compile errors introduced by #16953 (#16955) 2023-08-25 21:07:24 +00:00
Andrew Kelley
a31748b29e std.os.uefi: reorganize namespaces
This is a breaking change.

This commit applies the following rules to std.os.uefi:
* avoid redundant names in the namespace such as "protocol.FooProtocol"
* don't initialize struct field to undefined. do that at the
  initialization site if you want that, or create a named constant that
  sets all the fields to undefined.
* avoid the word "data", "info", "context", "state", "details", or
  "config" in the type name, especially if a word from that category is
  already in the type name.
* embrace tree structure

After following these rules, `usingnamespace` disappeared naturally.
This commit eliminates 26/53 (49%) instances of `usingnamespace` in the
standard library. All these uses were due to not understanding how
to properly use namespaces.

I did not test this commit. The standard library UEFI code is
experimental and pull requests have been accepted with minimal vetting.
Users of std.os.uefi will need to submit follow-up pull requests to fix
up whatever regressions this commit introduces, this time without
abusing namespaces (pun intended).
2023-08-24 22:38:47 -07:00
matu3ba
7a834e2581
std.windows: use atomic rename, if possible (#16717)
Mitigates #14978.

Uses the same strategy as in #16499 suggested by @squeek502
2023-08-23 20:11:01 -04:00
Andrew Kelley
ada0010471 compiler: move unions into InternPool
There are a couple concepts here worth understanding:

Key.UnionType - This type is available *before* resolving the union's
fields. The enum tag type, number of fields, and field names, field
types, and field alignments are not available with this.

InternPool.UnionType - This one can be obtained from the above type with
`InternPool.loadUnionType` which asserts that the union's enum tag type
has been resolved. This one has all the information available.

Additionally:

* ZIR: Turn an unused bit into `any_aligned_fields` flag to help
  semantic analysis know whether a union has explicit alignment on any
  fields (usually not).
* Sema: delete `resolveTypeRequiresComptime` which had the same type
  signature and near-duplicate logic to `typeRequiresComptime`.
  - Make opaque types not report comptime-only (this was inconsistent
    between the two implementations of this function).
* Implement accepted proposal #12556 which is a breaking change.
2023-08-22 13:54:14 -07:00
Carl Åstholm
60fc18bd1c compiler_rt: fix f80 comparisons
This corrects comparisons between negative numbers.
2023-08-21 11:26:25 -07:00
Gregory Mullen
f74e10cd47 Update default stack frames for general_purpose_allocator.zig
Created from a conversation with  @andrewrk on irc: Memory leaks when using ArrayList can be inconvenient to debug when the stack frame size is 4 because the entirety of the printed frame is within zig stdlib, and not in the users calling stack. Increasing this to 6 for Debug builds, gives 2 frames of user code. I increased the frame size for tests as well by the equivalent factor, but I'm unconvinced that's actually desirable.
2023-08-21 11:22:22 -07:00
mlugg
283afb50b5 AstGen: disallow '-0' integer literal
The intent here is ambiguous: this resolves to the comptime_int '0', but
it's likely the user meant to use a floating-point literal.

Resolves: #16890
2023-08-21 11:47:31 +03:00
mlugg
321961d860 AstGen: add result location analysis pass
The main motivation for this change is eliminating the `block_ptr`
result location and corresponding `store_to_block_ptr` ZIR instruction.
This is achieved through a simple pass over the AST before AstGen which
determines, for AST nodes which have a choice on whether to provide a
result location, which choice to make, based on whether the result
pointer is consumed non-trivially.

This eliminates so much logic from AstGen that we almost break even on
line count! AstGen no longer has to worry about instruction rewriting
based on whether or not a result location was consumed: it always knows
what to do ahead of time, which simplifies a *lot* of logic. This also
incidentally fixes a few random AstGen bugs related to result location
handling, leading to the changes in `test/` and `lib/std/`.

This opens the door to future RLS improvements by making them much
easier to implement correctly, and fixes many bugs. Most ZIR is made
more compact after this commit, mainly due to not having redundant
`store_to_block_ptr` instructions lying around, but also due to a few
bugs in the old system which are implicitly fixed here.
2023-08-20 11:58:14 -07:00
Ryan Liptak
020105d0dd Cache: Fix findPrefix when paths are slightly out of the ordinary
This makes Cache.findPrefix/findPrefixResolved use `std.fs.path.relative` instead of `std.mem.startsWith` when checking if a file is within a prefix. This fixes multiple edge cases around prefix detection:

- If a prefix path ended with a path separator, then the first character of the 'sub_path' would get cut off because the previous implementation assumed it was a path separator. Example: prefix: `/foo/`, file_path: `/foo/abc.txt` would see that they both start with `/foo/` and then slice starting from one byte past the common prefix, ending up with `bc.txt` instead of the expected `abc.txt`
- If a prefix contained double path separators after any component, then the `startsWith` check would erroneously fail. Example: prefix: `/foo//bar`, file_path: `/foo/bar/abc.txt` would not see that abc.txt is a sub path of the prefix `/foo//bar`
- On Windows, case insensitivity was not respected at all, instead the UTF-8 bytes were compared directly

This fixes all of the things in the above list (and possibly more).
2023-08-19 22:32:24 -07:00