-
Notifications
You must be signed in to change notification settings - Fork 13.3k
size_of cannot be called outside of a function #6320
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
Comments
It can't be implemented as a macro or syntax extension, because they have no knowledge of types. They just generate an AST. |
Not sure what changes would need to be made to make this work, but as it would likely entail changing the constant language, nominating for milestone 1, well-defined |
Accepted for milestone 1, well-defined |
Nominating as I believe this is totally out of scope for 1.0. |
We are probably not going to get to this for 1.0; we've reserved the |
Extending constant expressions or adding CTFE would need to go through an RFC, and I don't think there's consensus for adding an ever increasing number of special cases (like |
…ge_contains_using_float, r=llogiq Fix suggestion in `manual_range_contains` when using float Fix rust-lang#6315 changelog: Fix suggestion in `manual_range_contains` when using float
…24-09-10 subtree-push nightly-2024-09-10
I realize this isn't an issue that can be fixed by changing the definition of sys::size_of, however it seems like Rust (like any systems programming language) should have a mechanism for determining the size of a type.
a-la:
Could be implemented with a macro? Something like
size_of!(MyType)
.The text was updated successfully, but these errors were encountered: