ABI compatibility for repr(C) structs (and unions)
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
- 35/100
Hướng nghiên cứu
Start by comparing the two Miri examples in the issue: identical repr(C) structs with different names behave differently when passed through extern "C". The issue asks whether struct names should affect ABI compatibility and what rules explain the behavior; done means documenting or deciding those rules, which requires unsafe-code and ABI design knowledge.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Currently, this code is accepted in miri:
mod m1 {
unsafe extern "C" {
pub fn foo(x: Foo);
}
#[repr(C)]
pub struct Foo {
pub x: i32,
pub y: i32,
}
}
mod m2 {
#[unsafe(no_mangle)]
extern "C" fn foo(x: Foo) {
dbg!(x);
}
#[repr(C)]
#[derive(Debug)]
struct Foo {
x: i32,
y: i32,
}
}
pub fn main() {
unsafe {
m1::foo(m1::Foo { x: 5, y: 3 });
}
}
But it wasn't working in previous versions of miri. If I rename one to Foo2, it no longer works in neither version. To me, it is very surprising that the behavior depends on the name, but I can imagine where it comes from. I didn't find the PR who did this, so I thought it might be a regression somehow. If it is intended, I'm curious about the underlying rules and how it depends on the names.
- 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 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
rust-lang/unsafe-code-guidelines#631 · 7 bình luận ·
-
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 ·
Tất cả issue của rust-lang/unsafe-code-guidelines
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
leanprover/lean4#16876 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Claiming namespace logbrewĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
EclipseFdn/open-vsx.org#16437 ·
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
-
Fix routes for adminĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
ToolManager skips numeric coercion for Optional/union params and for "3.0" → int (follow-up to #276)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100