`repr(transparent)` ignores fields that do not have "trivial ABI"
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Read the linked PRs #157973 and #155984 to understand the trivial ABI change and the stalled implementation. Then trace how repr(transparent) determines which fields it ignores and inspect the related compiler tests. Done means transparent representation ignores only fields with trivial ABI, with regression coverage for the two zero-sized array fields shown in the issue.
由索引模型根据 Issue 内容生成。
描述
In https://github.com/rust-lang/rust/pull/157973 we introduced the concept of "trivial ABI", and declared that types like [u8; 0] or repr(C) 1-ZST do not have trivial ABI. However, repr(transparent) still ignores such types, so we accept e.g.
#[repr(transparent)]
struct S {
a: [u8; 0],
b: [i8; 0],
}
Since it's not clear which field is being wrapped by S, we basically have to make S ABI-compatible with all its fields, but the two fields are not ABI-compatible so that does not work out. We should therefore transition repr(transparent) to only ignore fields that have "trivial ABI".
@Jules-Bertholet started working on that in https://github.com/rust-lang/rust/pull/155984. However, the work has stalled, so I figured it'd be worth opening an issue to track this. @Jules-Bertholet do you still plan to get back to that PR, or would you be fine with someone else picking up the work?
- 主要语言
- Rust
- 星标
- 122k
- 派生
- 16.7k
- 平均合并
- 2 天 16 小时
- 30 天内合并 PR
- 515
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
rust-lang/rust 的其他 Issue
-
Remove unnecessary parentheses when suggesting to remove '&' from a pattern可能已有人在做 @BartSimpson001 于 1 天前认领。 未关闭A-diagnostics D-invalid-suggestion T-compiler
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
Windows `File::set_permissions` silently does nothing when clearing `readonly` leaves `FileAttributes == 0`可能已有人在做 @ChrisDenton 于 11 天前认领。 未关闭A-filesystem C-bug O-windows T-libs
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
A-run-make relnotes relnotes-needs-review relnotes-tracking-issue T-lang T-libs
难度 1/5 1 小时以内 新手友好度 72/100
维护者通常 1 天内回复
-
A-LLVM O-Arm O-UEFI O-x86_64 relnotes relnotes-needs-review relnotes-tracking-issue T-compiler
难度 1/5 1 小时以内 新手友好度 72/100
rust-lang/rust#165504 · 1 条评论 ·
维护者通常 1 天内回复
-
relnotes relnotes-tracking-issue T-libs
难度 1/5 1 小时以内 新手友好度 72/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
antithesishq/bombadil#473 ·
维护者通常 2 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
libracoder/kiri#669 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 5 天内回复
-
autofixer: follow-up
难度 2/5 1-3 小时 新手友好度 75/100
tursodatabase/turso#12217 ·
维护者通常 1 天内回复
-
Declare the CMS schema library in the optional recipients extra可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭area:python in-progress
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复