-
Notifications
You must be signed in to change notification settings - Fork 13.6k
fix handling of base address for TypeId allocations #144187
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing really changes here, but I looked at the code to ensure it is correct for TypeId and realized some ways in which it, and the comments, could be improved.
This comment has been minimized.
This comment has been minimized.
31b35e0
to
2ad5678
Compare
Is it intentional that this PR does not fix the |
Yes, catching UB is not a requirement for CTFE as it has significant impact on compile times. A program that does UB if two type ids do not match may suddenly stop erroring with the next compiler release, or error even if the type ids match. |
Also, you can't use it to get a |
2ad5678
to
3f9be40
Compare
#144169 landed so this PR is no longer blocked. |
@bors r+ rollup |
fix handling of base address for TypeId allocations This fixes the problems discovered by `@theemathas` in rust-lang#142789: - const-eval would sometimes consider TypeId pointers to be null - the type ID is different in Miri than in regular executions Both boil down to the same issue: the TypeId "allocation" has a guaranteed 0 base address, but const-eval assumes it was non-zero (like normal allocations) and Miri randomized it (like normal allocations). r? `@oli-obk`
This fixes the problems discovered by @theemathas in #142789:
Both boil down to the same issue: the TypeId "allocation" has a guaranteed 0 base address, but const-eval assumes it was non-zero (like normal allocations) and Miri randomized it (like normal allocations).
r? @oli-obk