-
Notifications
You must be signed in to change notification settings - Fork 1.2k
adding SUN_LEN macro to linux glibc/musl #4269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
b247c2b to
ee55445
Compare
|
I'm just going to mark this blocked since I don't yet know what to do without @rustbot blocked |
|
Reminder, once the PR becomes ready for a review, use |
ee55445 to
7236f08
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
8b3eb59 to
8891822
Compare
8891822 to
83539f3
Compare
|
@rustbot ready |
| #[cfg(target_env = "gnu")] | ||
| #[allow(unused_unsafe)] | ||
| pub fn SUN_LEN(s: crate::sockaddr_un) -> usize { | ||
| offset_of!(crate::sockaddr_un, sun_path) + crate::strlen(s.sun_path.as_ptr()) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add #[allow(unused_unsafe)] in the macro instead? There isn't any unsafe here.
| let fptr = unsafe { core::ptr::addr_of!((*ptr).$field) }; | ||
| let off = (fptr as usize).checked_sub(ptr as usize).unwrap(); | ||
| assert!(off <= core::mem::size_of::<$Ty>()); | ||
| core::assert!(off <= core::mem::size_of::<$Ty>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you could split macro changes to a separate commit that would be ideal (distinct changes in separate commits makes the backporting easier)
- assert! access from core. - nested unsafe raises an error on older rust compilers on CI.
glibc ref musl ref