Should regular assignments really retag?

Đang mở
#601 4 bình luận 0 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
25/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
rust
Lĩnh vực
compilers

Hướng nghiên cứu

Start with the parent unsafe-code-guidelines issue #371 and Rust issue #151728, then compare the retagging questions for assignments, function calls, and returns described here. The issue is resolved when the project reaches and records a decision about which operations should retag references and boxes.

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

Mô tả

A-aliasing-model

This issue is a part of https://github.com/rust-lang/unsafe-code-guidelines/issues/371, but it seems to me this particular design decision warrants its own thread as it is a fairly well-defined self-contained question: should a plain "e1 = e2" really retag all references (and boxes) that are being copied here?

This makes assignment a surprisingly rich operation, and even gives it a non-trivial side-effect. It is the cause of the UB in https://github.com/rust-lang/rust/issues/151728 and probably others.

The main reason we're doing this is to be consistent with function calls: there, we pretty much have to do such retags if we want to add noalias attributes for references that are being passed in fields of structs/enums. But assignments are a lot more common than function calls, so maybe it is justified to special-case function calls? Retags would then basically only happen on function calls and when there are (implicit or explicit) reference-of operators being executed. There's a lot of implicit reference-of operators inserted all over the place, but not in generic code where this issue is particularly nasty since one can easily forget reasoning about the case where T = &mut _/T = Box<_>.

Function returns are different from assignments, so the question also arises for them.

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ề Compilers

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.