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

Add support for the unstable f16 and f128 types #2042

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

Brezak
Copy link
Contributor

@Brezak Brezak commented Nov 9, 2024

Also extend unsafe_impl with support for adding arbitrary attributes to the impls.

Closes #1999

@Brezak Brezak force-pushed the new-floats branch 2 times, most recently from 2c86de4 to 9e04925 Compare November 9, 2024 14:36
@codecov-commenter
Copy link

codecov-commenter commented Nov 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.64%. Comparing base (e3b2ec1) to head (37cecbd).

Additional details and impacted files
@@           Coverage Diff           @@
##           v0.8.x    #2042   +/-   ##
=======================================
  Coverage   87.64%   87.64%           
=======================================
  Files          16       16           
  Lines        6016     6016           
=======================================
  Hits         5273     5273           
  Misses        743      743           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@joshlf joshlf left a comment

Choose a reason for hiding this comment

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

This looks great, thanks so much for the contribution! A few small changes requested, but broadly this looks good to go.

Cargo.toml Outdated Show resolved Hide resolved
src/impls.rs Outdated Show resolved Hide resolved
src/util/macros.rs Outdated Show resolved Hide resolved
src/util/macros.rs Outdated Show resolved Hide resolved
Copy link
Member

@joshlf joshlf left a comment

Choose a reason for hiding this comment

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

Okay awesome! One more very small nitpick and then this should be ready for approval!

src/impls.rs Outdated
Comment on lines 75 to 78
#[cfg(feature="float-nightly")]
unsafe_impl!(#[cfg_attr(doc_cfg, doc(cfg(feature = "float-nightly")))] f16: Immutable, TryFromBytes, FromZeros, FromBytes, IntoBytes);
#[cfg(feature="float-nightly")]
unsafe_impl!(#[cfg_attr(doc_cfg, doc(cfg(feature = "float-nightly")))] f128: Immutable, TryFromBytes, FromZeros, FromBytes, IntoBytes);
Copy link
Member

Choose a reason for hiding this comment

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

For consistency with other uses:

Suggested change
#[cfg(feature="float-nightly")]
unsafe_impl!(#[cfg_attr(doc_cfg, doc(cfg(feature = "float-nightly")))] f16: Immutable, TryFromBytes, FromZeros, FromBytes, IntoBytes);
#[cfg(feature="float-nightly")]
unsafe_impl!(#[cfg_attr(doc_cfg, doc(cfg(feature = "float-nightly")))] f128: Immutable, TryFromBytes, FromZeros, FromBytes, IntoBytes);
#[cfg(feature = "float-nightly")]
unsafe_impl!(#[cfg_attr(doc_cfg, doc(cfg(feature = "float-nightly")))] f16: Immutable, TryFromBytes, FromZeros, FromBytes, IntoBytes);
#[cfg(feature = "float-nightly")]
unsafe_impl!(#[cfg_attr(doc_cfg, doc(cfg(feature = "float-nightly")))] f128: Immutable, TryFromBytes, FromZeros, FromBytes, IntoBytes);

Copy link
Member

@joshlf joshlf left a comment

Choose a reason for hiding this comment

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

Awesome, thanks again for all your work on this!

@joshlf joshlf added this pull request to the merge queue Nov 13, 2024
Merged via the queue into google:v0.8.x with commit 6681065 Nov 13, 2024
87 checks passed
google-pr-creation-bot pushed a commit to google-pr-creation-bot/zerocopy that referenced this pull request Nov 13, 2024
@joshlf
Copy link
Member

joshlf commented Nov 13, 2024

Backporting in #2058.

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