rust icon indicating copy to clipboard operation
rust copied to clipboard

Add methods to create StableMIR constant

Open celinval opened this issue 1 year ago • 1 comments

I've been experimenting with transforming the StableMIR to instrument the code with potential UB checks.

The modified body will only be used by our analysis tool, however, constants in StableMIR must be backed by rustc constants. Thus, I'm adding a few functions to build constants, such as building string and other primitives.

One question I have is whether we should create a global allocation instead for strings.

r? @oli-obk

celinval avatar Mar 12 '24 20:03 celinval

This PR changes Stable MIR

cc @oli-obk, @celinval, @spastorino, @ouz-a

rustbot avatar Mar 12 '24 20:03 rustbot

One question I have is whether we should create a global allocation instead for strings.

what do you mean with that? First create a smir Allocation and then convert that?

oli-obk avatar Mar 13 '24 16:03 oli-obk

My bad, I think the stable method already does that for string references. :)

celinval avatar Mar 13 '24 17:03 celinval

@bors r+ rollup

oli-obk avatar Mar 13 '24 17:03 oli-obk

:pushpin: Commit 893a9107b9f8b2038d77648a2ca4b06f36d3009d has been approved by oli-obk

It is now in the queue for this repository.

bors avatar Mar 13 '24 17:03 bors