Skip to content

Add support for the unstable f16 and f128 types - #2042

Merged
joshlf merged 1 commit into
google:v0.8.xfrom
Brezak:new-floats
Nov 13, 2024
Merged

joshlf merged 1 commit into
google:v0.8.xfrom
Brezak:new-floats

Conversation

@Brezak

@Brezak Brezak commented Nov 9, 2024

Copy link
Copy Markdown
Contributor

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

codecov-commenter commented Nov 9, 2024 •

Copy link
Copy Markdown

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.

@joshlf joshlf left a comment

Copy link
Copy Markdown
Member

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.

Comment thread Cargo.toml Resolved
Comment thread src/impls.rs Resolved
Comment thread src/util/macros.rs Resolved
Comment thread src/util/macros.rs Resolved
@Brezak
Brezak requested a review from joshlf November 12, 2024 19:47
@Brezak
Brezak force-pushed the new-floats branch 2 times, most recently from f2c86d6 to 37cecbd Compare November 12, 2024 21:11

@joshlf joshlf left a comment

Copy link
Copy Markdown
Member

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!

Comment thread 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
Copy Markdown
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);

@joshlf joshlf left a comment

Copy link
Copy Markdown
Member

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
google-pr-creation-bot pushed a commit to google-pr-creation-bot/zerocopy that referenced this pull request Nov 13, 2024
@joshlf

joshlf commented Nov 13, 2024

Copy link
Copy Markdown
Member

Backporting in #2058.

github-merge-queue Bot pushed a commit that referenced this pull request Nov 13, 2024
Closes #1999

Co-authored-by: Brezak <bezak.adam@proton.me>
@Brezak
Brezak deleted the new-floats branch November 14, 2024 08:43
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