Skip to content
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

Just use core::mem::offset_of!() on rustc >= 1.77 #83

Merged
merged 2 commits into from
Mar 26, 2024
Merged

Just use core::mem::offset_of!() on rustc >= 1.77 #83

merged 2 commits into from
Mar 26, 2024

Conversation

coolreader18
Copy link
Contributor

@coolreader18 coolreader18 commented Mar 21, 2024

Stable mem::offset_of!(), yay!

I'm unsure about the README changes, maybe those old nightly instructions are just not needed at all anymore?

src/lib.rs Outdated
@@ -59,7 +59,10 @@
feature(const_ptr_offset_from)
)]
#![cfg_attr(feature = "unstable_const", feature(const_refs_to_cell))]
#![cfg_attr(feature = "unstable_offset_of", feature(allow_internal_unstable))]
#![cfg_attr(
all(feature = "unstable_offset_of", not(stable_offset_of)),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO we should just remove the unstable feature. It's unstable so not covered by semver / stability.

src/offset_of.rs Outdated
@@ -350,7 +382,7 @@ mod tests {

#[cfg(any(
feature = "unstable_const",
feature = "unstable_offset_of",
any(feature = "unstable_offset_of", stable_offset_of),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nested any doesn't make a lot of sense, this can be flattened into a single any

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yeah lol. I just did a find/replace.

@Gilnaa
Copy link
Owner

Gilnaa commented Mar 21, 2024

Thank you!

@RalfJung do you think this is a good time to bump the version to 1.0.0? (Hopefully the last one)

CHANGELOG.md Outdated
@@ -3,6 +3,8 @@
## Unreleased
- Clarify documentation about macro indirection
- Added changelog
- Turn the crate into a stdlib polyfill on rustc>=1.77
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes no sense. A polyfill is something that adds missing functionality. If anything this crate is a polyfill on older rustc. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, true - I was just reusing the wording from a bit further down.

@RalfJung
Copy link
Collaborator

RalfJung commented Mar 22, 2024

do you think this is a good time to bump the version to 1.0.0? (Hopefully the last one)

I'll leave that to @Gilnaa. But I don't see how this crate suddenly would be more stable than before now (in particular the parts outside of offset_of! that it offers). If anything it is less necessary and hopefully most people will use the native offset_of! directly. :)

@coolreader18
Copy link
Contributor Author

I was thinking that hopefully this could be released to the 0.9.x and maybe 0.8.x release series, since it makes memoffset a super super light dependency when using stable rustc. Maybe even keep unstable_offset_of for 0.9, since it seems like that's why 0.9 was created in the first place?

@RalfJung
Copy link
Collaborator

RalfJung commented Mar 26, 2024

This is already a super light dependency, I don't see the benefits of backporting.

But I think this means we should do a 0.9.1 release with this, not a 1.0 release, so that the 0.9 series users get this update.

@RalfJung
Copy link
Collaborator

This PR looks good, thanks. :)

@RalfJung RalfJung merged commit d553d8c into Gilnaa:master Mar 26, 2024
16 checks passed
@coolreader18 coolreader18 deleted the stable_offset_of branch March 27, 2024 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants