Repository navigation
Commit ebc24db
* docs(errors): orphan-rule class is now reshaped by cargo-cgp
cargo-cgp reshapes the orphan-rule namespace-registration class into a
[CGP-E011] message naming the foreign namespace and key. Update the class doc's
"How cargo-cgp presents it", "Notes for tooling", raw-diagnostic framing, and
backing-fixture paths (usability/ -> acceptable/wiring/orphan/) to match.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* docs(errors): verbose cascade is now coalesced by cargo-cgp
cargo-cgp collapses a check-trait-failure cascade to a single block: it drops
the intermediate provider-trait noise and coalesces the checked components that
share one root cause into one headline listing every affected consumer trait
over a single root-cause tree. Update the class doc's "How cargo-cgp presents
it", "Notes for tooling", and backing-fixture entries (usability/ ->
acceptable/duplication/) to match.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(macro): span derive(HasField) impls onto their fields
The HasField/HasFieldMut impls generated by `#[derive(HasField)]` carried
the macro's `call_site` span on their `impl`/`{ … }` boundary, so any error
about one field's impl — a coherence conflict (E0119), or the "but trait
`HasField<…>` is implemented for it" near-miss hint in a missing-field check
error — underlined the whole `#[derive(HasField)]` instead of the field.
Re-span each generated impl onto its field via `override_item_span` (the
field identifier for a named field, the whole `syn::Field` for a tuple
field), matching the delegate_components!/default_impl technique. Only the
boundary tokens move, so interior references stay at call_site and
go-to-definition on the field is unaffected.
The raw-diagnostic caret is pinned by the cargo-cgp UI fixtures (22
`.rust.stderr` baselines re-blessed there); documents the mechanism in the
HasField implementation doc's new Error spans section.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(macro): span all data-derive impls onto their source tokens
Extend the HasField span fix to every other extensible-data derive:
HasFields, FromVariant, ExtractField, BuildField, and the CgpData/
CgpRecord/CgpVariant umbrellas that compose them. Each generated impl
carried the derive's `call_site` span on its `impl`/`{ … }` boundary, so
any error about it underlined the whole `#[derive(...)]` rather than the
field, variant, or type it derives from.
Re-span each impl via `override_item_span`, keyed by kind: per-field
impls (`UpdateField`, builder `HasField`) onto their field, per-variant
impls (`FromVariant`, `ExtractField`) onto their variant, and whole-type
impls (`HasFields`/`FromFields`/`ToFields`/…, `HasBuilder`, the
`HasExtractor` family, `FinalizeBuild`/`FinalizeExtract`, `PartialData`)
onto the struct/enum name. Re-spanning lives in the shared codegen
helpers, so every composing entry point inherits it. The `__Partial…`
companion types are cloned from user input and keep their own spans.
Only the boundary tokens move, so interior references stay at call_site
and go-to-definition is unaffected. Documents the mechanism in each
affected implementation doc's new Error spans section.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* docs(errors): document the equality-pinned abstract-type failure
A provider that pins an abstract type with `#[use_type(Trait.{Assoc = Concrete})]`
while the context binds it elsewhere fails as an `E0271` projection mismatch
rather than the `E0277` the rest of this class produces: the trait half of the
bound holds, so only the associated type disagrees. Record it as a sub-case with
its own tells — the caret landing on the `#[cgp_type]` attribute that defined the
type, the supplied type absent from the message, and the cascade one shared
abstract type produces — and note that cargo-cgp now reshapes it into
[CGP-E017], naming both types and the wiring entry to change.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 34d9ea5 commit ebc24db
25 files changed
Lines changed: 154 additions & 37 deletions
File tree
- crates/macros/cgp-macro-core/src/types/cgp_data
- derive_builder
- derive_extractor
- derive_has_fields
- docs
- errors
- checks
- wiring
- implementation/entrypoints
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
52 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
53 | 56 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
47 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
48 | 51 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
58 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
59 | 67 | | |
60 | 68 | | |
61 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
50 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
51 | 54 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
36 | 39 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
102 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
103 | 111 | | |
104 | 112 | | |
105 | 113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
119 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
120 | 126 | | |
121 | 127 | | |
122 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
64 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
65 | 68 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
65 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
| |||
137 | 140 | | |
138 | 141 | | |
139 | 142 | | |
140 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
141 | 146 | | |
142 | 147 | | |
143 | 148 | | |
| |||
209 | 214 | | |
210 | 215 | | |
211 | 216 | | |
212 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
213 | 220 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
59 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
60 | 63 | | |
0 commit comments