-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Differing results for std::mem::size_of
computation
#115028
Comments
std::mem::size_of
computation in std::mem::size_of
computation
My apologies, after a more detailed investigation this seems as if it is an issue with updating project dependencies. One of the project dependencies |
Doesn't look like a bug to me then, just a confusing consequence of checking in library lockfiles. One thing is that emitting hard errors in size asserts is a pretty bad thing in general to do as changes in the layout algorithm (or as we've seen here, in dependencies) could cause build failures. They should be |
Add disclaimer on size assertion macro Sometimes people are inspired by rustc to add size assertions to their code and copy the macro. This is bad because it causes hard build errors. rustc happens to be special where it makes this okay. For example, see rust-lang#115028 (not sure whether they were directly inspired by this function), but I think I've also seen other cases.
I have a project that is split into two repositories:
hashc
)hi
)The
hi
repository specifies through cargo to be dependent on the master branch ofhashc
.hashc
repository crates contain somestatic_assert_size!
assertions, which are implemented in the following way (exactly as it is inrustc
itself):Building
hashc
on its own with the following assertions in place does not produce an error:However, building
hi
repository trips one of the assertions as having a mismatching size:It is bizarre that this is happening on the same machine with the same toolchain, but the crates are being required through a repository rather than a local crate.
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: