Skip to content

volatile_{load,store} with statics. Heap allocations. And transmuting wrappers.#989

Open
dkcumming wants to merge 5 commits intomasterfrom
dc/volatile-constants
Open

volatile_{load,store} with statics. Heap allocations. And transmuting wrappers.#989
dkcumming wants to merge 5 commits intomasterfrom
dc/volatile-constants

Conversation

@dkcumming
Copy link
Collaborator

@dkcumming dkcumming commented Mar 16, 2026

This is a bit of everything in one go, but what I was trying to do was isolate the case seen in this Kompass test that was discussed in #987. The volatile_load is coming from Box::new which we are not supporting right now as that does heap allocation.

This PR:

  • Adds failing tests for statics (not decoding properly)
  • Adds a failing test for Box::new
  • Supports sound transmutation between transparent wrappers (in #[repr(rust)] case and their wrapped type. Seen as a thunk earlier in the Box::new proof and I thought I would solve it now. There are tests for this changed from failing passing in the commit history.

So the volatile_load is expected to fail until we figure out some support for the things that these tests fail on. This is not blocking any work now so I think it is fine just to add the failing tests

Copy link
Contributor

@Stevengre Stevengre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Want an issue just in case. If you don't have time, please let me know, I can introduce one when I have time.

requires #transparentFieldTy(lookupTy(TY_TARGET)) ==K TY_SOURCE

// Down: Wrapper(T) -> T
rule <k> #cast(Aggregate(variantIdx(0), ListItem(VAL)), castKindTransmute, TY_SOURCE, TY_TARGET)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! And I trust you that you've already saw the red and added these to make it green. I'd like to give you approval to let you continue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But would you mind to draft an issue about refactoring these casting things? It looks quite the same but we have to deal with them one by one.

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

Successfully merging this pull request may close these issues.

2 participants