Break the ABI promise around `MaybeUninit`
还没有人认领这个 Issue。
评估
调研方向
Start with the MaybeUninit API docs and the ABI compatibility list linked above, then read the earlier ptr::copy debate in unsafe-code-guidelines#518. The open question is whether to replace the blanket ABI promise with an integer/SIMD allowlist or a narrower denylist; the proposed lint firing on MaybeUninit in extern "C" declarations is the concrete entry point for ecosystem exploration. Done would mean an agreed policy plus crater/lint evidence, not a newcomer patch.
由索引模型根据 Issue 内容生成。
描述
We keep discovering that the MaybeUninit ABI promise (which didn't make it to this list but is mentioned in the MaybeUninit API docs) is causing problems:
- For
bool, the LLVM IR we generate is not in a shape where LLVM would guarantee ABI compatibility to us. Fixing this would require non-trivial changes on the LLVM side, if it is practical at all, and would also entirely preclude some hypothetical ABIs. - For float types, upholding the promise will become pretty much impossible when we migrate to the byte type. We need
MaybeUninit<f64>to map tob64on the LLVM side to ensure that partially initializedf64have their initialized bytes preserved, but LLVM has no way of knowing that this particularb64should be passed as a float rather than an int. Maybe LLVM could be extended to make that work, but it's not clear if upstream LLVM is really open to this idea. - Doing a copyof type
Tviaptr::copyis not the same as doing the copy at typeMaybeUninit<T>: the latter erases padding. That's very surprising and not at all intentional. (This was the topic of a previous debate in https://github.com/rust-lang/unsafe-code-guidelines/issues/518.)
It seems fairly inevitable that we have to break our ABI promise at least a little bit. In the opsem meeting, people ere generally on-board with exploring the option of replacing the promise of ABI compatibility for all types with a promise that only covers a particular set of types (in particular integers, and hopefully SIMD vectors of integers). There's an alternative where we only take back the promise for bool and float types and structs containing bool or float types, but even assembling that list would be quite non-trivial, and there's a non-trivial risk that more surprises are lurking in this space. So if we can get away with it, having an allowlist would be much better than a denylist.
To see whether this is feasible, we're going to have to do a bit of ecosystem exploration.
- @joshlf is letting the LLMs lose on this to try and find impacted code.
- We agreed to do a crater run with a lint that fires on
MaybeUninitinextern "C"function declarations. (Someone still has to volunteer to write that lint. :)
- 主要语言
- 没有语言数据
- 星标
- 760
- 派生
- 68
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
rust-lang/unsafe-code-guidelines 的其他 Issue
-
I-opsem-nominated
难度 4/5 3-5 天 新手友好度 35/100
rust-lang/unsafe-code-guidelines#634 · 5 条评论 ·
-
难度 5/5 一周以上 新手友好度 15/100
-
难度 5/5 一周以上 新手友好度 12/100
rust-lang/unsafe-code-guidelines#632 · 8 条评论 · 1 个 reaction ·
-
I-opsem-nominated
难度 5/5 一周以上 新手友好度 20/100
rust-lang/unsafe-code-guidelines#630 · 1 个 reaction ·
-
难度 5/5 一周以上 新手友好度 25/100
查看 rust-lang/unsafe-code-guidelines 的全部 Issue
相似的 Issue
-
bug core-lang
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Call-argument syntax diagnostic needs example spacing and removal of confusing trailing sentence未关闭
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
mw00/project-maya#1368 ·
维护者通常 2 天内回复
-
test(bind-json): legacy Solidity fixture requires an unavailable solc on Linux ARM64可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
foundry-rs/foundry#18828 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复