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

crucible-mir: Split out the Misc CastKind into more precise constructors #1223

Open
RyanGlScott opened this issue Jul 18, 2024 · 0 comments
Open
Labels
crucible MIR Issues relating to Rust/MIR support technical debt

Comments

@RyanGlScott
Copy link
Contributor

Currently, the Misc CastKind is a catch-all for several unrelated CastKinds, as can be seen in this code:

-- TODO: actually plumb this information through if it is relevant
-- instead of using Misc
Just (String "PointerExposeAddress") -> pure Misc
Just (String "PointerFromExposedAddress") -> pure Misc
Just (String "DynStar") -> pure Misc
Just (String "IntToInt") -> pure Misc
Just (String "FloatToInt") -> pure Misc
Just (String "FloatToFloat") -> pure Misc
Just (String "IntToFloat") -> pure Misc
Just (String "PtrToPtr") -> pure Misc
Just (String "FnPtrToPtr") -> pure Misc
x -> fail ("bad CastKind: " ++ show x)

As a result, it is difficult to distinguish between all of these CastKinds in Mir.Trans.evalCast'. I propose that we delete the Misc constructor and replace it with more precise constructors that reflect the structure of the CastKind enum in the rustc API. This will require some detective work to figure out which existing uses of Misc are covered by which CastKind variants.

@RyanGlScott RyanGlScott added crucible technical debt MIR Issues relating to Rust/MIR support labels Jul 18, 2024
RyanGlScott added a commit that referenced this issue Jul 18, 2024
Currently, `crucible-mir`'s implementation of `CastKind` lags behind the
`rustc` API's `CastKind` enum. Let's leave a link to the relevant issue (#1223)
as breadcrumbs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crucible MIR Issues relating to Rust/MIR support technical debt
Projects
None yet
Development

No branches or pull requests

1 participant