Skip to content

fix: force canonical name for builtin std module name#633

Merged
aherrmann merged 2 commits intoaherrmann:mainfrom
cerisier:std-canonical-name
Apr 24, 2026
Merged

fix: force canonical name for builtin std module name#633
aherrmann merged 2 commits intoaherrmann:mainfrom
cerisier:std-canonical-name

Conversation

@cerisier
Copy link
Copy Markdown
Contributor

This is a small one but required to build Zig with rules_zig instead since we have to do a zig_library for std.
There is a hardcoded rule in the handling of --dep in zig that doesn't allow doing anything else but --dep=std=std.

https://codeberg.org/ziglang/zig/src/commit/5cc281e7232b9f1bc5f4d732e4a37fb5df02f780/src/main.zig#L1091-L1097

There is a hardcoded rule in handling of --dep in zig that
doesn't allow doing anything else but --dep=std=std
@cerisier cerisier changed the title Force canonical name for builtin std module name fix: force canonical name for builtin std module name Apr 24, 2026
Copy link
Copy Markdown
Owner

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is ctx.label.name == "std" the right condition? Shouldn't this trigger on ctx.attr.import_name == "std"? Otherwise this would falsely trigger on the following:

# //foo:BUILD.bazel
zig_library(
    name = "std",
    import_name = "foo_std",
    ...
)

@cerisier
Copy link
Copy Markdown
Contributor Author

Indeed ! I'll check import_name if it's not None and fallback on name.

@cerisier
Copy link
Copy Markdown
Contributor Author

Amended

Copy link
Copy Markdown
Owner

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@aherrmann aherrmann merged commit 904063e into aherrmann:main Apr 24, 2026
18 checks passed
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

Successfully merging this pull request may close these issues.

2 participants