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

Make must_cast by-value and by-shared-ref functions const #261

Merged
merged 2 commits into from
Aug 11, 2024

Conversation

zachs18
Copy link
Contributor

@zachs18 zachs18 commented Aug 8, 2024

(but not by-mut-ref, since that's not stable).

This would raise the MSRV of the must_cast feature from 1.57.0 to 1.64.0 (when slice_from_raw_parts was made const-stable). Alternately, this could be added as a new feature (const_must_cast?) with its own MSRV1.

The new arm of the transmute! macro is to work around borrowing a generic type in const-eval not being allowed on stable, since the borrowed type could have interior mutabilty. Transmuting via union does not have this issue, since no borrowing occurs.

Footnotes

  1. must_cast and must_cast_ref's MSRV is at least 1.61.0, when const_fn_trait_bound was stabilized. must_cast_slice's MSRV is at least 1.64.0, as mentioned.

@zachs18
Copy link
Contributor Author

zachs18 commented Aug 8, 2024

(I believe the CI failures are due to rust-lang/rust#128808)

@Lokathor
Copy link
Owner

Lokathor commented Aug 8, 2024

Because it's an optional feature and because 1.64 is quite old at this point i think we can ignore the msrv.

I'd like to probably wait on CI if the nightly rust bug is going to only be a day or two

@zachs18
Copy link
Contributor Author

zachs18 commented Aug 11, 2024

(Current nightly has the fix; force-pushed for CI)

@Lokathor Lokathor merged commit 5eecd33 into Lokathor:main Aug 11, 2024
14 checks passed
@Lokathor Lokathor added the semver-minor semver minor change label Aug 16, 2024
@Lokathor
Copy link
Owner

Released bytemuck-v1.17.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-minor semver minor change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants