Git Product home page Git Product logo

Comments (3)

Lokathor avatar Lokathor commented on June 24, 2024

While I'd agree that both of these could have a Pod impl (where T:Pod), I'm not so confident that generically that's always true.

but then again that can maybe be said of some C structs. hmm.

from bytemuck.

a1phyr avatar a1phyr commented on June 24, 2024

I'm not so confident that generically that's always true.

#[repr(transparent)] totally guaranties that if it is.

For #[repr(C)] structs it would be much harder to do I think, this is why my suggestion is to do that for #[repr(transparent)] types only, at least at first.

from bytemuck.

Lokathor avatar Lokathor commented on June 24, 2024

Hm, I suppose if all of the ZST values in the type are also Pod then that would work out correctly. So I think we could do this if that check was part of the derive. Even if it's overly conservative, that's better than being too permissive with an unsafe trait, and people can always bypass the derive's logic and just impl the trait themselves if they are that confident they know the situation best.

As with other derive changes, I don't know that code as well and so I'm very unlikely to make the change myself. However, I could accept a PR for it.

from bytemuck.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.