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

Stamp out transmute except in certain cases #373

Open
kamalmarhubi opened this issue May 20, 2016 · 1 comment
Open

Stamp out transmute except in certain cases #373

kamalmarhubi opened this issue May 20, 2016 · 1 comment

Comments

@kamalmarhubi
Copy link
Member

nix is currently a bit too liberal with mem::transmute, using it in situations where some casts would suffice. I'd like to reduce these to a minimum because transmute is a scarily big hammer.

@fiveop
Copy link
Contributor

fiveop commented Jun 29, 2016

All occurences. We can discuss each case and tick them off.

git grep -n transmute | while read line; do echo -n $line |  sed -r 's/([a-z\/\.]+\:[0-9]+:).*/\1/g' | sed -r 's/([^\:]+)\:([^\:]+)\:/\- \[ \] https\:\/\/github\.com\/nix-rust\/nix\/blob\/9c6c71a9f5fa4a64d8e5c2996988a93ff5f724c8\/\1#L\2\n/g'; done

bors bot added a commit that referenced this issue Aug 17, 2017
700: Get rid of a lot of transmutes r=asomers

Most could be replaced by simple raw pointer casts (or even perfectly
safe coercions!).

cc #373

725: Match syntax of libc_bitflags! with bitflags! r=asomers

Also update a couple of constant declarations while we're at it.
bors bot added a commit that referenced this issue Aug 17, 2017
700: Get rid of a lot of transmutes r=asomers

Most could be replaced by simple raw pointer casts (or even perfectly
safe coercions!).

cc #373
asomers added a commit to asomers/nix that referenced this issue Aug 10, 2021
This saves code in several separate places that need to do this
separately.  At the same time, remove a few uses of mem::transmute that
were implementing TryFrom or similar functionality.

Issue nix-rust#373
asomers added a commit to asomers/nix that referenced this issue Aug 10, 2021
This saves code in several separate places that need to do this
separately.  At the same time, remove a few uses of mem::transmute that
were implementing TryFrom or similar functionality.

Issue nix-rust#373
asomers added a commit to asomers/nix that referenced this issue Aug 10, 2021
This saves code in several separate places that need to do this
separately.  At the same time, remove a few uses of mem::transmute that
were implementing TryFrom or similar functionality.

Issue nix-rust#373
bors bot added a commit that referenced this issue Aug 10, 2021
1485: Replace some mem::transmute calls in signal.rs with pointer casts r=asomers a=asomers

Issue #373

Co-authored-by: Alan Somers <[email protected]>
bors bot added a commit that referenced this issue Aug 11, 2021
1484: Optionally implement TryFrom in libc_enum! r=asomers a=asomers

This saves code in several separate places that need to do this
separately.  At the same time, remove a few uses of mem::transmute that
were implementing TryFrom or similar functionality.

Issue #373

Co-authored-by: Alan Somers <[email protected]>
asomers added a commit to asomers/nix that referenced this issue Aug 11, 2021
There was a better case for using it before mem::uninitialized was
available, but not great.  Even before then, mem::zeroed could've been
used instead.

Issue nix-rust#373
asomers added a commit to asomers/nix that referenced this issue Aug 11, 2021
There was a better case for using it before mem::uninitialized was
available, but not great.  Even before then, mem::zeroed could've been
used instead.

Issue nix-rust#373
asomers added a commit to asomers/nix that referenced this issue Aug 18, 2021
There was a better case for using it before mem::uninitialized was
available, but not great.  Even before then, mem::zeroed could've been
used instead.

Issue nix-rust#373
bors bot added a commit that referenced this issue Aug 18, 2021
1489: Don't use mem::transmute in SignalFd r=asomers a=asomers

    There was a better case for using it before mem::uninitialized was
    available, but not great.  Even before then, mem::zeroed could've been
    used instead.
    
    Issue #373


Co-authored-by: Alan Somers <[email protected]>
bors bot added a commit that referenced this issue Aug 18, 2021
1489: Don't use mem::transmute in SignalFd r=asomers a=asomers

    There was a better case for using it before mem::uninitialized was
    available, but not great.  Even before then, mem::zeroed could've been
    used instead.
    
    Issue #373


Co-authored-by: Alan Somers <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants