Skip to content

AI updates #6#257

Merged
soareschen merged 5 commits into
mainfrom
ai-updates-20260708
Jul 20, 2026
Merged

AI updates #6#257
soareschen merged 5 commits into
mainfrom
ai-updates-20260708

Conversation

@soareschen

Copy link
Copy Markdown
Collaborator

This PR does two independent things at once: it moves CGP's compile-error guidance out of the standard-library diagnostic hooks and into cargo-cgp, and it adopts a new public tag line and propagates it across the READMEs and the communication-strategy docs. Along the way it grows the compile-fail test suite and the error catalog to cover a failure mode the diagnostics change makes newly relevant. The two efforts touch different parts of the tree — a handful of core trait definitions and the docs — and share no code, but they land together because both are about how CGP explains itself to a reader, one to a developer staring at a compiler error and the other to a newcomer meeting the project for the first time.

Delegating diagnostics to cargo-cgp

The core change is the removal of every #[diagnostic::on_unimplemented] attribute from the four traits that carried one. Those attributes told rustc what note to print when a bound went unsatisfied — the "you might want to implement the provider trait" hint on DelegateComponent, the "add #[cgp_provider(...)]" hint on IsProviderFor, and the "add #[derive(HasField)]" hints on HasField and HasFieldMut. They are now gone, and the responsibility for turning a raw trait error into an actionable message shifts to cargo-cgp, the post-processor that already resolves check failures through the trait solver. The rationale is consolidation: a hand-written on_unimplemented string is a second, less capable diagnostic engine living in the library, and it competes with the richer, type-aware messages cargo-cgp can produce from the same failure.

The effect on the raw compiler output is deliberate and visible in the new test fixtures. Without the attribute, rustc falls back to its generic "the trait bound ... is not satisfied" wording plus the required for ... chain, and it is that unadorned shape the new .stderr snapshots pin. This is the anatomy the error catalog now teaches a reader (and a tool) to decode by structure rather than by a canned note.

New error tests and catalog coverage

The PR adds three compile-fail fixtures under check_components, each paired with a checked-in .stderr snapshot, and documents the failure classes they capture. Two fixtures — higher_order_inner_dependency.rs and higher_order_outer_dependency.rs — are a matched pair that pins how the diagnostic shape identifies which layer of a higher-order provider carries an unmet dependency: an inner-layer failure runs the required for ... chain through both providers' IsProviderFor and carries a "redundant requirement hidden" note, while an outer-layer failure stops at the outer provider and never names the inner one. The third, missing_has_field_derive.rs, pins the case where a struct has the field a getter names but is missing #[derive(HasField)] altogether, so the tell is the absence of the "but trait HasField<...> is implemented for it" landmark that a single missing field would otherwise produce.

The documentation grows to match. A new catalog page, docs/errors/checks/higher-order-provider-layer.md, is the anatomy of the higher-order failure class — what triggers it, how the inner and outer cases differ block by block, where the root cause sits, how to resolve it, and what a cargo-cgp-style tool should extract. The existing check-trait-failure.md gains a "when the derive is missing entirely" section for the third fixture. The new class is cross-linked from the errors README, from verbose-cascade.md, from the e0277 code page, and from the debugging guide, which now notes that the chain shape already leans toward one layer before a reader reaches for #[check_providers(...)].

Adopting the new tag line

The second effort settles CGP's one-line description on "A language extension for Rust, with pluggable trait implementations at compile-time," retiring the long-serving "a modular programming paradigm for Rust" and the interim "reusable, swappable trait implementations" phrasing. The reasoning is captured in a near-complete rewrite of docs/communication-strategy/tag-lines.md, which turns what was a brainstorm of candidates into a settled decision document: it justifies the line word by word ("extension" over "a language" to stay honest, "pluggable" over "reusable" because traits are already Rust's reuse mechanism, "at compile-time" to defuse the runtime-DI misreading), lays out the high-level pitch that should follow the line, and supplies four model introductions tuned to different venues. The old "modular programming paradigm" framing is kept only as retired historical background.

The new wording then propagates outward so nothing contradicts the settled line. The top-level README.md and docs/README.md lead with it; vocabulary.md adds "pluggable trait implementations" as the chosen lead descriptor and adds "reusable" to the terms-to-avoid list; and selling-points.md, formats.md, attention-and-engagement.md, and worked-examples.md are updated so their guidance and finished sample copy use the new line rather than the old candidates. The README code sample is also reflowed into the multi-line delegate_components! form, a purely cosmetic touch to the example.

Impacts

The changes above ripple out in several distinct directions, listed here because they are largely independent of one another rather than steps in one argument.

  • Raw compiler errors lose their built-in hints. A developer who is not running cargo-cgp now sees rustc's generic unsatisfied-bound wording without the "add #[derive(HasField)]" or "add #[cgp_provider]" notes that previously appeared inline. The guidance is not lost, but it now lives behind the post-processor rather than in the compiler output itself.
  • cargo-cgp becomes the intended path for good diagnostics. The library now assumes the post-processor is present to produce actionable messages, so the quality of the CGP error experience depends on it more than before. The new catalog pages double as the spec a tool follows to reconstruct those messages.
  • The compile-fail snapshots now encode the post-removal error shape. The three new .stderr files (and the behavior of any existing ones that referenced the removed notes) capture rustc's output without the on_unimplemented text, so they will fail if the attributes are ever reintroduced — the tests now guard the delegation decision.
  • A previously undocumented failure class is now catalogued and test-backed. Higher-order provider layer failures and the missing-derive variant are covered by fixtures, an anatomy page, and cross-links, extending the errors knowledge base and giving cargo-cgp a documented target for the "which layer is at fault" fact.
  • All public-facing framing must now echo one settled tag line. Because tag-lines.md is settled rather than under selection, any future change to the line has to be propagated across README, docs/README, vocabulary.md, formats.md, worked-examples.md, and attention-and-engagement.md in the same change; the tag-lines document now states that synchronization obligation explicitly.
  • "Reusable" is now a discouraged word and "pluggable" the preferred one. Future CGP writing, including anything generated from these docs, should describe the core capability as "pluggable" (or "interchangeable"), which changes the vocabulary contributors and agents are expected to follow.
  • No runtime or API behavior changes. The trait definitions are unchanged apart from the removed attribute macros, which carry no runtime meaning, so nothing about how CGP compiles or executes is affected; the impact is confined to diagnostics, tests, and documentation.

soareschen and others added 5 commits July 8, 2026 23:37
…ation strategy

Retire the incumbent "a modular programming paradigm for Rust" in favor of
the chosen "a language extension for Rust, with pluggable trait implementations
at compile-time."

- Rewrite communication-strategy/tag-lines.md around the single chosen line:
  word-by-word analysis, the incumbent kept only as historical background, the
  post-tag-line pitch funnel, and model introductions for a new audience.
- Lead cgp/README.md and docs/README.md with the new tag line and introduction.
- Propagate the line through selling-points, formats, worked-examples, and
  vocabulary (recording "pluggable" as the lead descriptor and noting that
  "reusable" undersells the novelty to a Rust reader), and fix the now-stale
  "tag-line shortlist" reference in attention-and-engagement.
- Update the communication-strategy README catalog entry to match.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@soareschen
soareschen merged commit 941b273 into main Jul 20, 2026
3 checks passed
@soareschen
soareschen deleted the ai-updates-20260708 branch July 20, 2026 19:40
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.

1 participant