immunant / c2rust

Migrate C code to Rust
https://c2rust.com/
Other
3.91k stars 229 forks source link

analyze: add support for some unsupported casts #929

Closed spernsteiner closed 1 year ago

spernsteiner commented 1 year ago

This adds various cases to emit_cast_desc_desc to eliminate all the "unsupported cast" warnings in the current tests, and also changes "unsupported cast" to a panic. In general, "unsupported cast" normally means we're generating code that won't compile (due to type errors), so this is actually a major error for the rewriter.

Currently based on #923; I will rebase onto master once that's been merged.

spernsteiner commented 1 year ago

I rebased this onto master and ran into a test failure with the newly-added test function from #945. To fix it, I took several commits from #936 (all related to expanding mir_op's cast generation, so it makes sense to include them here) and added them to this branch. The commits in question are here.

I'm not sure if it's worth re-reviewing, since both this and #945 were already approved. @aneksteind, I've re-requested review just in case - feel free to just hit approve if you don't think it's necessary.

kkysen commented 1 year ago

The new commits from #936 LGTM.

aneksteind commented 1 year ago

@spernsteiner consider this re-approval 👍