diff --git a/CHANGELOG.md b/CHANGELOG.md index ef4f636..8e30940 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), ## [Unreleased] +### Changed + +- **`HasMessageView` carries a `#[diagnostic::on_unimplemented]` hint.** When a + type is used where the generated view family is required but its crate was + generated without one (buffa older than 0.7.0, or views disabled) or has it + behind a disabled feature, the compile error now explains the cause and how + to fix it — regenerate the defining crate with buffa ≥ 0.7.0 and views + enabled (`generate_views(true)` / `views=true`), or enable the crate's views + feature — instead of only naming the missing trait bound. Downstream + consumers such as connect-rust rely on this trait for their request + wrappers, so the notes land directly in the consumer's build output. + ## [0.7.0] - 2026-05-28 This release is a minor bump under the diff --git a/buffa/src/view.rs b/buffa/src/view.rs index 045c0bc..7ecefa3 100644 --- a/buffa/src/view.rs +++ b/buffa/src/view.rs @@ -241,6 +241,15 @@ pub trait ViewReborrow: MessageView<'static> { /// Implementations are generated alongside the view and owned-view wrapper /// (and are therefore gated with them). Hand-written implementations are only /// needed for hand-written view types and must follow the same shape. +#[diagnostic::on_unimplemented( + message = "`{Self}` does not implement `HasMessageView` — its message-view family was not generated or is not enabled", + note = "the `HasMessageView` impl is emitted next to each message's view types: \ + regenerate the crate that defines `{Self}` with buffa 0.7.0 or newer and \ + views enabled — `generate_views(true)` (on by default) in a buffa-build / \ + buffa-codegen config, or `views=true` for protoc-gen-buffa", + note = "if the defining crate feature-gates its generated impls, enabling its views \ + feature is enough — no regeneration needed" +)] pub trait HasMessageView: crate::Message + Sized { /// The zero-copy view of `Self`, borrowing from a buffer with lifetime /// `'a`.