Skip to content

Conversation

@devnexen
Copy link
Contributor

@rustbot
Copy link
Collaborator

rustbot commented Feb 15, 2025

r? @tgross35

rustbot has assigned @tgross35.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@tgross35
Copy link
Contributor

I'm just going to mark this blocked since I don't yet know what to do without offset_of!. I don't think we want to add a new config specific for this macro, but maybe something like a recent-msrv cargo feature is possible.

@rustbot blocked

@tgross35
Copy link
Contributor

Added an offset_of! macro in 1808393, this should be able to go forward with that.

@rustbot author

@rustbot
Copy link
Collaborator

rustbot commented Oct 29, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot
Copy link
Collaborator

rustbot commented Oct 29, 2025

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.

@devnexen devnexen force-pushed the linux_sun_len branch 5 times, most recently from 8b3eb59 to 8891822 Compare October 29, 2025 23:39
@devnexen
Copy link
Contributor Author

@rustbot ready

Comment on lines 5881 to 5885
#[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())
}
Copy link
Contributor

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>());
Copy link
Contributor

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants