Skip to content

feat(docs): support 0.16.0#320

Open
jinzhongjia wants to merge 1 commit intomainfrom
016
Open

feat(docs): support 0.16.0#320
jinzhongjia wants to merge 1 commit intomainfrom
016

Conversation

@jinzhongjia
Copy link
Copy Markdown
Member

No description provided.

- `std.process.getCwd*` 改名为 `currentPath*`
- `fs.path.relative` 变成纯函数,需要显式传入上下文
- `File.Stat.atime` 变成可选值
- `std.mem` 里 “index of” 系列统一更名为 “find”
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚫 [AutoCorrect Lint] <AutoCorrect> reported by reviewdog 🐶

Suggested change
- `std.mem`“index of” 系列统一更名为 “find”
- `std.mem`“index of”系列统一更名为“find”


也就是说,Zig 不再想长期维护那批半高层、半底层的历史包装函数。

### `std.mem` 的 “index of” 系列统一更名为 “find”
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚫 [AutoCorrect Lint] <AutoCorrect> reported by reviewdog 🐶

Suggested change
### `std.mem`“index of” 系列统一更名为 “find”
### `std.mem`“index of”系列统一更名为“find”

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the documentation to reflect the release of Zig 0.16.0. It includes a new version description file and a comprehensive upgrade guide from version 0.15.1, along with updates to the sidebar and theme configuration. The review feedback identifies two issues in the upgrade guide's code examples: a redundant constant redefinition in the C import section and a syntax error in the representation of the deprecated @type usage.

Comment on lines +32 to +38
pub const c = @cImport({
@cInclude("stdio.h");
@cInclude("math.h");
@cInclude("stdlib.h");
});

const c = @import("c.zig").c;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The "Old way" code block contains a redefinition of the constant c. It first defines c using @cImport and then immediately tries to redefine it using @import. These should be presented as separate examples or the redundant line should be removed to avoid confusion.

Suggested change
pub const c = @cImport({
@cInclude("stdio.h");
@cInclude("math.h");
@cInclude("stdlib.h");
});
const c = @import("c.zig").c;
pub const c = @cImport({
@cInclude("stdio.h");
@cInclude("math.h");
@cInclude("stdlib.h");
});

常见迁移:

```zig
@Type(.enum_literal)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

In the "Old way" example, @Type(.enum_literal) is syntactically incorrect for Zig versions prior to 0.16.0. The @Type built-in expects a std.builtin.Type union value, so it should be @Type(.{ .enum_literal = .{} }).

Suggested change
@Type(.enum_literal)
@Type(.{ .enum_literal = .{} })

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.

1 participant