From 6dfc8fc173d225920a6934afdb96cb2cdb0c4234 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 19 Jul 2026 13:17:44 +0000 Subject: [PATCH] feat(ogar-emitter): emit include!-safe projection headers (// not //!) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit emit_projection_adapters led with //! inner-doc lines, which rustc rejects (E0753) when the generated file is include!'d into a module at a non-start position — exactly the consumer adoption pattern (include! the generated impl next to a private row type as the live From). Switch the two header lines to plain // line comments so the emitted file is include!-safe anywhere; a standalone-module consumer can carry its doc separately. Golden test updated. 4/4 emitter tests green. Generated by [Claude Code](https://claude.com/claude-code) --- crates/ogar-emitter/src/projection_adapter.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/ogar-emitter/src/projection_adapter.rs b/crates/ogar-emitter/src/projection_adapter.rs index 304a239f..e6cb2745 100644 --- a/crates/ogar-emitter/src/projection_adapter.rs +++ b/crates/ogar-emitter/src/projection_adapter.rs @@ -144,8 +144,12 @@ pub fn emit_projection_adapters(classes: &[ProjectionClass]) -> String { sorted.sort_by(|a, b| a.domain_type.cmp(&b.domain_type)); let mut out = String::new(); - out.push_str("//! Generated projection adapters — DO NOT EDIT.\n"); - out.push_str("//! Emitted from the ClassView column->field projection recipe (Pattern A).\n"); + // Line comments (not `//!` inner-doc) so the emitted file is + // `include!`-safe: a consumer can `include!` this straight into a + // module (e.g. next to a private row type) as the live `impl`, which + // an inner-doc attribute at a non-start position would reject (E0753). + out.push_str("// Generated projection adapters — DO NOT EDIT.\n"); + out.push_str("// Emitted from the ClassView column->field projection recipe (Pattern A).\n"); out.push('\n'); let mut minted = 0usize; @@ -296,8 +300,8 @@ mod tests { #[test] fn patient_projection_golden_is_pinned() { let out = emit_projection_adapters(&[patient_projection()]); - let expected = r#"//! Generated projection adapters — DO NOT EDIT. -//! Emitted from the ClassView column->field projection recipe (Pattern A). + let expected = r#"// Generated projection adapters — DO NOT EDIT. +// Emitted from the ClassView column->field projection recipe (Pattern A). // [concept: patient class_id: 0x0901] impl From for Patient {