Skip to content

Build fails with expected type '*std.mem.Allocator', found 'std.mem.Allocator' #429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
llimllib opened this issue Dec 1, 2021 · 11 comments

Comments

@llimllib
Copy link

llimllib commented Dec 1, 2021

With zls 227dcb4 and zig 8c36243, zls config gives:

$ git clone --recurse-submodules https://github.com/zigtools/zls
cd zls
zig build -Drelease-safe
./zig-out/bin/zls config # Configure ZLS
Cloning into 'zls'...
remote: Enumerating objects: 3567, done.
remote: Counting objects: 100% (569/569), done.
remote: Compressing objects: 100% (329/329), done.
remote: Total 3567 (delta 381), reused 355 (delta 232), pack-reused 2998
Receiving objects: 100% (3567/3567), 1.43 MiB | 3.27 MiB/s, done.
Resolving deltas: 100% (2491/2491), done.
Submodule 'src/known-folders' (https://github.com/ziglibs/known-folders) registered for path 'src/known-folders'
Submodule 'src/zinput' (https://github.com/ziglibs/zinput) registered for path 'src/zinput'
Cloning into '/private/tmp/zls/src/known-folders'...
remote: Enumerating objects: 145, done.
remote: Counting objects: 100% (145/145), done.
remote: Compressing objects: 100% (101/101), done.
remote: Total 145 (delta 80), reused 78 (delta 38), pack-reused 0
Receiving objects: 100% (145/145), 41.68 KiB | 609.00 KiB/s, done.
Resolving deltas: 100% (80/80), done.
Cloning into '/private/tmp/zls/src/zinput'...
remote: Enumerating objects: 108, done.
remote: Counting objects: 100% (108/108), done.
remote: Compressing objects: 100% (64/64), done.
remote: Total 108 (delta 51), reused 86 (delta 37), pack-reused 0
Receiving objects: 100% (108/108), 21.10 KiB | 21.10 MiB/s, done.
Resolving deltas: 100% (51/51), done.
Submodule path 'src/known-folders': checked out 'a282c26da51e5d2c01fec5c744e321ae248cf409'
Submodule path 'src/zinput': checked out '56da848c9aa8b5637114acff48576773a0ee998e'
./src/main.zig:1650:25: error: expected type '*std.mem.Allocator', found 'std.mem.Allocator'
    allocator = std.heap.page_allocator;
                        ^
/opt/homebrew/Cellar/zig/HEAD-8c36243_1/lib/zig/std/mem/Allocator.zig:1:1: note: std.mem.Allocator declared here
//! The standard memory allocation interface.
^
./src/main.zig:49:46: error: expected type 'std.mem.Allocator', found '*std.mem.Allocator'
    var arena = std.heap.ArenaAllocator.init(allocator);
                                             ^
/opt/homebrew/Cellar/zig/HEAD-8c36243_1/lib/zig/std/log.zig:144:21: note: called from here
            root.log(message_level, scope, format, args);
                    ^
/opt/homebrew/Cellar/zig/HEAD-8c36243_1/lib/zig/std/log.zig:189:16: note: called from here
            log(.err, scope, format, args);
               ^
/opt/homebrew/Cellar/zig/HEAD-8c36243_1/lib/zig/std/start.zig:554:28: note: called from here
                std.log.err("{s}", .{@errorName(err)});
                           ^
/opt/homebrew/Cellar/zig/HEAD-8c36243_1/lib/zig/std/start.zig:537:22: note: called from here
pub fn callMain() u8 {
                     ^
/opt/homebrew/Cellar/zig/HEAD-8c36243_1/lib/zig/std/mem/Allocator.zig:1:1: note: std.mem.Allocator declared here
//! The standard memory allocation interface.
^
zls...The following command exited with error code 1:
/opt/homebrew/Cellar/zig/HEAD-8c36243_1/bin/zig build-exe /private/tmp/zls/src/main.zig -OReleaseSafe --cache-dir /private/tmp/zls/zig-cache --global-cache-dir /Users/llimllib/.cache/zig --name zls --pkg-begin build_options /private/tmp/zls/zig-cache/options/L9eqxgIAE4PmL1q7z-R9mddPxCA1hxdCO2SbWbMoIU3gyy2e0E0-nMjqqyAeR5Ke --pkg-end --pkg-begin known-folders /private/tmp/zls/src/known-folders/known-folders.zig --pkg-end --pkg-begin zinput /private/tmp/zls/src/zinput/src/main.zig --pkg-end --enable-cache
error: the following build command failed with exit code 1:
/private/tmp/zls/zig-cache/o/38fb50fd3fcfc7f3b51b5ebd7edf28d5/build /opt/homebrew/Cellar/zig/HEAD-8c36243_1/bin/zig /private/tmp/zls /private/tmp/zls/zig-cache /Users/llimllib/.cache/zig -Drelease-safe
-bash: ./zig-out/bin/zls: No such file or directory
@gerred
Copy link
Contributor

gerred commented Dec 1, 2021

Confirmed.

@SuperAuguste
Copy link
Member

Caused by ziglang/zig#10055, issuing a fix soon

@SuperAuguste
Copy link
Member

Should be fixed by #430 :)

@dmbfm
Copy link

dmbfm commented Dec 3, 2021

Should be fixed by #430 :)

It seems the error persists after #430, in fact the CI build fails. Should it have been merged with a CI fail?

@llimllib
Copy link
Author

llimllib commented Dec 3, 2021

It did build for me locally (Mac), I haven’t confirmed it works though

@dmbfm
Copy link

dmbfm commented Dec 3, 2021

It did build for me locally (Mac), I haven’t confirmed it works though

Using zig trunk it fails for me on Mac. The CI builds using Zig stable or trunk?

@SuperAuguste
Copy link
Member

The CI builds with the Zig version from the downloads page, which is slightly out of date at the moment. What commit of Zig are you building with @dmbfm? You might be using a pre-Allocgate version :)

@dmbfm
Copy link

dmbfm commented Dec 3, 2021

I'm using v0.9.0-dev.1815+20e19e75f from the download page! Is that pre-allocgate? I'm kind of lost on that.

I get this output:

❯ zig build -Drelease-safe
./main.zig:1650:25: error: expected type 'std.mem.Allocator', found '*std.mem.Allocator'
    allocator = std.heap.page_allocator;
                        ^
/Users/daniel/Sources/zig-macos-aarch64-0.9.0-dev.1815+20e19e75f/lib/zig/std/mem/Allocator.zig:1:1: note: std.mem.Allocator declared here
//! The standard memory allocation interface.
^
./main.zig:49:46: error: expected type '*std.mem.Allocator', found 'std.mem.Allocator'
    var arena = std.heap.ArenaAllocator.init(allocator);
                                             ^
/Users/daniel/Sources/zig-macos-aarch64-0.9.0-dev.1815+20e19e75f/lib/zig/std/log.zig:144:21: note: called from here
            root.log(message_level, scope, format, args);
                    ^
/Users/daniel/Sources/zig-macos-aarch64-0.9.0-dev.1815+20e19e75f/lib/zig/std/log.zig:194:16: note: called from here
            log(.err, scope, format, args);
               ^
/Users/daniel/Sources/zig-macos-aarch64-0.9.0-dev.1815+20e19e75f/lib/zig/std/start.zig:554:28: note: called from here
                std.log.err("{s}", .{@errorName(err)});
                           ^
/Users/daniel/Sources/zig-macos-aarch64-0.9.0-dev.1815+20e19e75f/lib/zig/std/start.zig:537:22: note: called from here
pub fn callMain() u8 {
                     ^
/Users/daniel/Sources/zig-macos-aarch64-0.9.0-dev.1815+20e19e75f/lib/zig/std/mem/Allocator.zig:1:1: note: std.mem.Allocator declared here
//! The standard memory allocation interface.
^
zls...The following command exited with error code 1:
/Users/daniel/Sources/zig-macos-aarch64-0.9.0-dev.1815+20e19e75f/zig build-exe /Users/daniel/Sources/zls/src/main.zig -OReleaseSafe --cache-dir /Users/daniel/Sources/zls/zig-cache --global-cache-dir /Users/daniel/.cache/zig --name zls --pkg-begin build_options /Users/daniel/Sources/zls/zig-cache/options/L9eqxgIAE4PmL1q7z-R9mddPxCA1hxdCO2SbWbMoIU3gyy2e0E0-nMjqqyAeR5Ke --pkg-end --pkg-begin known-folders /Users/daniel/Sources/zls/src/known-folders/known-folders.zig --pkg-end --pkg-begin zinput /Users/daniel/Sources/zls/src/zinput/src/main.zig --pkg-end --enable-cache
error: the following build command failed with exit code 1:
/Users/daniel/Sources/zls/zig-cache/o/11c4b23d40c2a12b2e0f041931a83533/build /Users/daniel/Sources/zig-macos-aarch64-0.9.0-dev.1815+20e19e75f/zig /Users/daniel/Sources/zls /Users/daniel/Sources/zls/zig-cache /Users/daniel/.cache/zig -Drelease-safe

@SuperAuguste
Copy link
Member

from the download page!
Probably, then :P

@dmbfm
Copy link

dmbfm commented Dec 3, 2021

Yeah, I had assumed the downloads page was in sync with trunk!

Just built zig from trunk on my machine and now zls builds without a problem.

Thanks!

@SuperAuguste
Copy link
Member

Poggers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants