Skip to content

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

Merged
RalfJung merged 2 commits intoGilnaa:masterfrom
coolreader18:stable_offset_of
Mar 26, 2024
Merged

Just use core::mem::offset_of!() on rustc >= 1.77#83
RalfJung merged 2 commits intoGilnaa:masterfrom
coolreader18:stable_offset_of

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
#![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
#[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
## 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
@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