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

MSRV 1.56.0 TODO #1688

Closed
asomers opened this issue Mar 23, 2022 · 3 comments · Fixed by #1872
Closed

MSRV 1.56.0 TODO #1688

asomers opened this issue Mar 23, 2022 · 3 comments · Fixed by #1872

Comments

@asomers
Copy link
Member

asomers commented Mar 23, 2022

After raising the MSRV to 1.56.0:

  • Simplify ipv4addr_to_libc and ipv4addr_to_libc by changing their bodies to a simple mem::transmute, since Ipv4Addr and Ipv6Addr are simple newtypes around the libc types.
@rtzoeller
Copy link
Collaborator

Is std::mem::transmute sound for std::net::Ipv4Addr? It isn't marked repr(transparent).

@asomers
Copy link
Member Author

asomers commented Mar 23, 2022

If we have a static_assertion that guarantees that Ipv4Addr and libc::sockaddr_in are the same size, then it's safe, right? That was my plan.

@rtzoeller
Copy link
Collaborator

I believe that should be fine.

bors bot added a commit that referenced this issue Nov 19, 2022
1872: Misc internal optimizations r=rtzoeller a=asomers

* Make ipv4addr_to_libc const
* Use mem::transmute in ipv4addr_to_libc and ipv6addr_to_libc

Fixes #1687
Fixes #1688

Co-authored-by: Alan Somers <asomers@gmail.com>
@bors bors bot closed this as completed in 80b2572 Nov 19, 2022
JonathanWoollett-Light pushed a commit to JonathanWoollett-Light/nix that referenced this issue Nov 20, 2022
* Make ipv4addr_to_libc const
* Use mem::transmute in ipv4addr_to_libc and ipv6addr_to_libc

Fixes nix-rust#1687
Fixes nix-rust#1688
StackOverflowExcept1on pushed a commit to StackOverflowExcept1on/nix that referenced this issue Nov 21, 2022
* Make ipv4addr_to_libc const
* Use mem::transmute in ipv4addr_to_libc and ipv6addr_to_libc

Fixes nix-rust#1687
Fixes nix-rust#1688
This issue was closed.
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 a pull request may close this issue.

2 participants