Commit Graph

19589 Commits

Author SHA1 Message Date
Loris Cro
580e633777 autodoc: added support for non-lazy decl paths 2022-07-19 19:10:11 -07:00
Loris Cro
253e7e112e autodoc: add frontend support for optionals & generic cleanup 2022-07-19 19:10:11 -07:00
Loris Cro
fbf0d0bee9 autodoc: fix decltest offset errors
while it would be preferable to not save decltests as first-class decls
(and just embed their information inside the decl they refer), adding
logic to skip them complicates the code too much so we should consider
this an optimization for the future.
2022-07-19 19:10:11 -07:00
Jacob G-W
a0ff7c8078 add decltests to the autodoc backend 2022-07-19 19:10:11 -07:00
Loris Cro
5d4c88c741 autodoc: added basic support for unresolved comptime expressions 2022-07-19 19:10:11 -07:00
Loris Cro
ee16eddecf autodoc: added basic support for @import 2022-07-19 19:10:11 -07:00
Loris Cro
4a868fa2be autodoc: escape html in decl ref names 2022-07-19 19:10:11 -07:00
Loris Cro
564d6c4960 autodocs: improve function rendering 2022-07-19 19:10:10 -07:00
Loris Cro
b296f5ac02 autodocs: added basic support for functions 2022-07-19 19:10:10 -07:00
Loris Cro
5a31126d89 autodocs: output data support for more types 2022-07-19 19:10:10 -07:00
Loris Cro
ef5a2e8d6f autodocs: added basic support for unions 2022-07-19 19:10:10 -07:00
Loris Cro
a04045c709 autodocs: fix rendering of non-type decls 2022-07-19 19:10:10 -07:00
Loris Cro
ce40f34cbc autodocs: added support for some non-type values 2022-07-19 19:10:10 -07:00
Loris Cro
29771440b2 autodocs: add support for int values 2022-07-19 19:10:10 -07:00
Loris Cro
0135d22716 autodocs: add support for indirect decl references 2022-07-19 19:10:10 -07:00
Loris Cro
38281c8ed4 autodoc: add declval support to docs js 2022-07-19 19:10:10 -07:00
Loris Cro
75d39a97a2 autodocs: fix merge conflict 2022-07-19 19:10:10 -07:00
Loris Cro
07ed8886b5 autodocs: refactoring: moved some fn arguments inside of self 2022-07-19 19:10:10 -07:00
Jacob G-W
9ad9664ea8 autdoc: install artifacts 2022-07-19 19:10:10 -07:00
Loris Cro
2dcaed743f autodocs: add support for block_inline 2022-07-19 19:10:10 -07:00
Jacob G-W
66a46888bb autodoc: generate WalkResults for ref types 2022-07-19 19:10:10 -07:00
Jacob G-W
025337a78d autodoc: don't hardcode file name 2022-07-19 19:10:10 -07:00
Loris Cro
652e13e7c0 autodoc: init work 2022-07-19 19:10:10 -07:00
Andrew Kelley
0efc6a35be Sema: fix enum value without tag name used as switch item
Previously stage2 would report a false positive compile error saying there
was no tag for this value.
2022-07-19 18:39:48 -07:00
Andrew Kelley
1d5f865cfa Sema: fix runtime instructions omitted
in the presence of comptime control flow.

fixes #12171
2022-07-19 17:45:38 -07:00
Andrew Kelley
046df9b7d0
Merge pull request #12131 from hnakamur/fix_big_int_Managed_mul_sqr_capacity_too_large
Fix std.math.big.int.Managed capacity after mul and sqr
2022-07-19 18:54:30 -04:00
Andrew Kelley
6fab6c3e46
Merge pull request #12164 from ziglang/llvm-opt-byref
LLVM: lower optional types as byref=true
2022-07-19 14:50:03 -04:00
Andrew Kelley
fe8c3ffeb1 LLVM: change commentary on isByRef
This branch originally started out as a potential workaround to
address #11450. It did not solve that problem, however, it did end
up fixing #11498!
2022-07-19 11:31:37 -07:00
Andrew Kelley
74fb65fb42 LLVM: lower all error unions as byref=true
Same reasoning as previous commit.
2022-07-19 11:26:19 -07:00
Andrew Kelley
bab570a225 LLVM: lower all structs as byref=true
Same reasoning as previous commit.
2022-07-19 11:26:18 -07:00
Andrew Kelley
65bc4d915d LLVM: lower optional types as byref=true
This is a possible workaround for
https://github.com/llvm/llvm-project/issues/56585

On my computer it makes stage3-release go from false positive
compilation errors on the behavior tests to "segmentation fault".
Is this forwards progress or backwards progress? I have no idea.

See #11450
2022-07-19 11:22:48 -07:00
LeRoyce Pearson
c26d9f6287 Read dynstr starting at rpath offset
Since we know the offset, we may as well read starting there. Still expects
rpath to fit in 4096 bytes; that might be worth fixing in the future.

Fixes issue #12112
2022-07-19 14:01:35 -04:00
Cody Tapscott
b93a38860d stage2: Change optional non-null field to i8
This is a workaround for https://github.com/llvm/llvm-project/issues/56585
which causes writes to i1 in memory to be optimized to an incorrect value.
Unfortunately, this does not save users from running into this bug with u1
in their own types.

However, this does seem to be enough to get the behavior tests working.
This resolves #11450 on my machine.
2022-07-19 13:33:41 -04:00
Veikka Tuominen
0e26c61499 std.fs: remove accidental comptime block 2022-07-17 11:54:13 +03:00
Veikka Tuominen
fcaeca5b0a std.fs: add Iterable versions of openDirAbsolute*
Follow up to 262f4c7b3a
2022-07-17 11:52:30 +03:00
Andrew Kelley
a39c51c6a4 Sema: fix UAF in coerceInMemoryAllowed 2022-07-16 13:48:12 -07:00
Vincent Rischmann
47c58cba59
Fix io_uring tests (#12134)
* io_uring: fix the timeout_remove test

The test does a IORING_OP_TIMEOUT followed with a IORING_OP_TIMEOUT_REMOVE
and assumed we would get the CQEs in the same order.

Linux v5.18 changed how this works and we now get them in the reverse order.

The documentation doesn't explicitly say which CQE we should get first
so just make the test work with both cases.

* io_uring: fix the remove_buffers test

The original test was buggy but accidentally worked with kernels < 5.18

The test assumed that IORING_OP_REMOVE_BUFFERS removed from the start of
but in fact the documentation doesn't specify which buffer is removed,
only that a certain number of buffers are removed.

Starting with the kernel 5.18 the check for the `used_buffer_id` fails.
Turns out that previous kernels removed buffers in such a way that the
remaining buffer for this read would always be 0, however this isn't
true anymore.

Instead of checking a specific value just check that the `used_buffer_id`
corresponds to a valid ID.
2022-07-16 10:05:11 -05:00
alichraghi
9c66fdadc7 std.testing: add refAllDeclsRecursive function 2022-07-16 12:33:25 +03:00
Ryan Liptak
43770c0103 Fix checkAllAllocationFailures being too strict when checking arg types
Before this would fail to compile:

```
fn testFn(alloc: std.mem.Allocator, arr: []const u8) !void {
    _ = alloc;
    _ = arr;
}

test "checkAll" {
    var arr = [_]u8{ 1, 2, 3 };
    try std.testing.checkAllAllocationFailures(std.testing.allocator, testFn, .{arr[0..]});
}
```

with the error `error: Unexpected type for extra argument at index 0: expected []const u8, found *[3]u8`

By removing this strict equality check, we allow the type checking to be done during the `@field(args, arg_i_str) = @field(extra_args, field.name);` instead, which then allows for things like type coercion to work, but still will give a compile error if the types are incorrect. So, after this change, the above succeeds (because `*[3]u8` can be coerced to `[]const u8`).

The new compile error when providing an incorrect type that can't be coerced looks like this:

```
zig/lib/std/testing.zig:639:35: error: expected type '[]const u8', found '*[3]u32'
        @field(args, arg_i_str) = @field(extra_args, field.name);
                                  ^
```
2022-07-16 12:32:20 +03:00
Veikka Tuominen
b2486fbc5e
Merge pull request #12121 from Vexu/span
Stage2 point to error location using spans
2022-07-16 12:22:53 +03:00
Veikka Tuominen
da94227f78
Merge pull request #12060 from Vexu/IterableDir
std.fs: split `Dir` into `IterableDir`
2022-07-16 12:18:21 +03:00
r00ster91
8f943b3d33 style: add missing comma
This is really minor but the issue this fixes is that if you copy-paste this output of `--show-builtin` into your `build.zig` for example then the formatter will format
```
pub const os = std.Target.Os{
    .tag = .freestanding,
    .version_range = .{ .none = {} }
};
```
to
```
pub const os = std.Target.Os{ .tag = .freestanding, .version_range = .{ .none = {} } };
```
which doesn't match the output.
With this comma, the output will stay the way it is after a `zig fmt`.
2022-07-16 09:03:04 +00:00
Hiroaki Nakamura
3e667fd292 Use Managed.len in sub, divFloor, and divTrunc too 2022-07-16 11:46:13 +09:00
Hiroaki Nakamura
0cee8372cf Use Managed.len() instead of Managed.toConst().limbs.len 2022-07-16 08:14:16 +09:00
Andrew Kelley
e867127a6c
Merge pull request #12127 from ziglang/llvm-abi-size
Audit LLVM ABI size
2022-07-15 14:48:21 -04:00
Hiroaki Nakamura
d63604b116 Fix std.math.big.int.Managed capacity after mul and sqr 2022-07-16 00:08:55 +09:00
Luuk de Gram
6ba2fb3db7 zig cc: support -Wl,--export=<symbol> 2022-07-15 16:59:23 +02:00
Jakub Konka
e3c8ba2dc5 ci: bump macOS image on Github Actions to macos-11
The currently used image is getting deprecated and every user is advised
to switch to either macos-11 or macos-12. The link to upstream
issue/notification:

https://github.com/actions/virtual-environments/issues/5583
2022-07-15 07:56:21 -07:00
Veikka Tuominen
cf207df592 Module: improve source spans for initializers and var types
```zig
const U = union { foo: u32, bar: u32 };
test {
    var a = U{ .foo = 1213, .bar = 1123 };
    _ = a;
}
test {
    var a: (123 + 5238094) = 0;
    _ = a;
}
```

before:
```
:30: note: additional initializer here
    var a = U{ .foo = 1213, .bar = 1123 };
                             ^~~
:12: error: expected type 'type', found 'comptime_int'
    var a: (123 + 5238094) = 0;
           ^
```
after:
```
:30: note: additional initializer here
    var a = U{ .foo = 1213, .bar = 1123 };
                            ~^~~~~~~~~~
:12: error: expected type 'type', found 'comptime_int'
    var a: (123 + 5238094) = 0;
           ^~~~~~~~~~~~~~~
```
2022-07-15 16:06:16 +03:00
Veikka Tuominen
1463144fc8 Compilation: point caret in error message at the main token 2022-07-15 15:11:43 +03:00