Break the ABI promise around `MaybeUninit`
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 10/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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. :)
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 760
- Fork
- 68
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của rust-lang/unsafe-code-guidelines
-
I-opsem-nominated
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
rust-lang/unsafe-code-guidelines#634 · 5 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 12/100
rust-lang/unsafe-code-guidelines#632 · 8 bình luận · 1 reaction ·
-
I-opsem-nominated
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
rust-lang/unsafe-code-guidelines#630 · 1 reaction ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Tất cả issue của rust-lang/unsafe-code-guidelines
Issue tương tự
-
bug core-lang
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Call-argument syntax diagnostic needs example spacing and removal of confusing trailing sentenceĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
mw00/project-maya#1368 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
test(bind-json): legacy Solidity fixture requires an unavailable solc on Linux ARM64Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
foundry-rs/foundry#18828 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày