Declare ptr2int transmutes to be UB

Đang mở
#630 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

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
20/100
Loại issue
Tài liệu
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
documentation

Hướng nghiên cứu

This is a design/spec issue in the unsafe-code-guidelines repository; the payload names no files or tests. Start by reading the linked discussions #286 and #328, then locate the guidelines text on pointer provenance and transmutes. Done means a written rule declaring ptr2int transmutes that carry provenance to be UB, with the OOM rationale and a note about zerocopy.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

I-opsem-nominated

We have previously discussed allowing ptr2int transmutes (where the ptr actually has provenance) while just implicitly dropping the provenance. This gives rise to "provenance monotonicity" as originally suggested by @digama0. However, we have since learned that this a major hurdle for the best option that we seem to have that lets us resolve the OOM problem. So to keep the design space open, I think it would be prudent to declare such a transmute UB. If we can figure out a solution to the OOM problem that is compatible with provenance monotonicity, we can take back this UB later, but for now I'd rather be conservative and give us some room to work in this space.

One main motivation for making it not UB was making life easier for zerocopy, so Cc @joshlf.

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

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của rust-lang/unsafe-code-guidelines

Tất cả issue của rust-lang/unsafe-code-guidelines

Issue tương tự

Thêm issue về Documentation

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.