Skip to content

Conversation

@nyurik
Copy link
Member

@nyurik nyurik commented Jan 30, 2026

there is no need to generate fn main, unless we are doing testing. The main fn is now added to the snapshot at the end, but is no longer part of the generator.

Additionally, move could not generate Rust code error context to the top level for consistency.

there is no need to generate fn main, unless we are doing testing. The main fn is now added to the snapshot at the end, but is no longer part of the generator.

Additionally, move `could not generate Rust code` error context to the top level for consistency.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the fn main() function from the code generator output, instead appending it only in test snapshots where trybuild requires a main function. It also moves the "could not generate Rust code" error context from an intermediate level to the top-level generate() method for consistency.

Changes:

  • Extracted a create_content helper function in tests that appends fn main() to generated code for trybuild compatibility
  • Removed main function generation from src/lib.rs code generator
  • Moved error context addition from codegen() to generate() for consistency
  • Updated all test snapshots to reflect the new main function placement (at end instead of middle)

Reviewed changes

Copilot reviewed 82 out of 82 changed files in this pull request and generated 1 comment.

File Description
tests/snapshots.rs Refactored to extract create_content() helper that appends main function for testing; both test functions now use this helper
src/lib.rs Removed main function generation from codegen() and moved error context to generate() for consistency
tests-snapshots/*.snap.rs (85 files) Updated snapshots showing main function moved from middle to end of generated code

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Jan 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@nyurik nyurik enabled auto-merge (squash) January 30, 2026 03:35
@nyurik nyurik merged commit dfa28d1 into oxibus:main Jan 30, 2026
7 checks passed
@nyurik nyurik deleted the rm-main branch January 30, 2026 06:02
@nyurik nyurik mentioned this pull request Jan 29, 2026
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.

2 participants