Skip to content

Conversation

@Rua
Copy link
Contributor

@Rua Rua commented Dec 6, 2025

@Rua Rua marked this pull request as draft December 6, 2025 19:00
@Rua
Copy link
Contributor Author

Rua commented Dec 7, 2025

I ran into an unexpected snag with this one: the stmts_block helper function is adding back the semicolon if it's missing. Ideally I would just remove that behaviour, but that has the obvious potential to break a lot of things, so does anyone know why it's there and what other things rely on it?

Copy link
Contributor

@kkysen kkysen left a comment

Choose a reason for hiding this comment

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

It seems this is passing c2rust-testsuite CI even though there are many errors, so something went wrong there. Ugh.

@Rua Rua force-pushed the return-tail-expr branch 7 times, most recently from 80842e4 to d50212e Compare December 10, 2025 18:40
@Rua Rua marked this pull request as ready for review December 10, 2025 19:05
@Rua
Copy link
Contributor Author

Rua commented Dec 10, 2025

I was able to remove the semicolon-adding code from stmts_block without any adverse effects in the tests, so let's hope it wasn't needed anywhere else. I think this is ready for review now.

@Rua Rua force-pushed the return-tail-expr branch 4 times, most recently from 410e68d to afaa014 Compare December 14, 2025 13:43
@Rua Rua force-pushed the return-tail-expr branch from 4dbc629 to a24257c Compare December 17, 2025 15:32
@Rua
Copy link
Contributor Author

Rua commented Dec 17, 2025

In order to solve #1506 I had to add another variant to the ImplicitReturnType enum, because with Void it was adding a return that doesn't belong there. I don't know if that's actually the correct solution here. I don't quite understand the label break stuff in the compound statements translation, and there is likely some interaction with #1509 as well.

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.

transpile: return is stripped from end of statement expressions transpile: return is emitted in final statement

2 participants