[codex] stamp generated marker with project identity and version - #75
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe generated module header now uses Cargo package name, version, and repository metadata through a Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Copy/Paste DetectionNo duplications found in 1 changed Rust file(s) (threshold: 100 tokens). |
There was a problem hiding this comment.
Code Review
This pull request updates the generated module header in antlr4-rust-gen.rs to dynamically include the generator's version and repository URL at compile time, and adds unit tests to verify this header. The feedback suggests optimizing the test assertion by using concat! instead of format! to avoid runtime string allocation.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| assert!(GENERATED_MODULE_HEADER.contains(&format!( | ||
| "@generated by antlr4-rust-gen v{}", | ||
| env!("CARGO_PKG_VERSION") | ||
| ))); |
There was a problem hiding this comment.
Since env!("CARGO_PKG_VERSION") is a compile-time constant, we can construct the expected string at compile time using concat! instead of allocating a new String at runtime with format!.
| assert!(GENERATED_MODULE_HEADER.contains(&format!( | |
| "@generated by antlr4-rust-gen v{}", | |
| env!("CARGO_PKG_VERSION") | |
| ))); | |
| assert!(GENERATED_MODULE_HEADER.contains(concat!( | |
| "@generated by antlr4-rust-gen v", | |
| env!("CARGO_PKG_VERSION") | |
| ))); |
6cddfdd to
0334b06
Compare
Summary
antlr-rust-runtimepackage name and version in the generated Rust module marker.concat!for the expected marker.Why
Generated parsers previously only carried
// @generated by antlr4-rust-gen - do not edit, which tied the marker to an internal helper binary name. Stamping the stable crate/project identity, version, and repository URL makes GitHub-search based outreach practical for very old generated parser versions after major releases.Validation
cargo test --quiet --bin antlr4-rust-gen generated_modules_start_with_file_level_headercargo test --quiet --test antlr4_rust_gen_cligit diff --check -- src/bin/antlr4-rust-gen.rs