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

std::mem::size_of::<type> is non-const #32021

Closed
lu-zero opened this issue Mar 3, 2016 · 1 comment
Closed

std::mem::size_of::<type> is non-const #32021

lu-zero opened this issue Mar 3, 2016 · 1 comment

Comments

@lu-zero
Copy link
Contributor

lu-zero commented Mar 3, 2016

It is sort of surprising and makes a little harder to generate code using macros like:

macro_rules! read_buf {
    ($ty: ty) => ({
        let mut buf = [0; std::mem::size_of::<$ty>()];

     ....
@huonw
Copy link
Member

huonw commented Mar 3, 2016

This is a dupe of rust-lang/rfcs#1144. Unfortunately, the feature has some (possibly) surprising subtleties that make it trickier than one might hope.

Thanks for filing!

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

No branches or pull requests

2 participants