Skip to content
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

Minimize: restructure ConstValue minimization #158

Closed
essickmango opened this issue Feb 22, 2024 · 2 comments
Closed

Minimize: restructure ConstValue minimization #158

essickmango opened this issue Feb 22, 2024 · 2 comments

Comments

@essickmango
Copy link
Contributor

essickmango commented Feb 22, 2024

Currently the minimizer only supports a few const values, and it assumes they are all represented as scalars.
However what should actually happen is that it should recursively translate the const value using the API from rust-lang/rust#121396, and therefore support arbitrary types.

@essickmango essickmango changed the title Restructure const minimization Minimize: restructure ConstValue minimization Feb 22, 2024
@RalfJung
Copy link
Collaborator

RalfJung commented Mar 7, 2024

So to make this a bit more concrete, this is about translate_const_val. That should start by calling let (ecx, val) = mk_eval_cx_for_const_val, and then match on the type (which it already does) and then use methods like ecx.read_scalar and ecx.project_field to recurse over the val.

Also, we should not be calling eval_to_allocation_raw. That has raw in its name for a reason. Quoting from its doc comment:

Do not use this directly, use the eval_to_const_value or eval_to_valtree instead.

Really translate_const should just call c.eval, then translate_const_uneval can be removed entirely.

@RalfJung
Copy link
Collaborator

RalfJung commented May 4, 2024

Fixed by #182

@RalfJung RalfJung closed this as completed May 4, 2024
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

No branches or pull requests

2 participants