Skip to main content

prefer_conflict_marker

Function prefer_conflict_marker 

Source
fn prefer_conflict_marker(input: &DeriveInput) -> TokenStream
Expand description

Emit a fixed-name conflict marker so that stacking two Prefer* derives on a single type produces a guided compile error instead of a cryptic E0119 conflicting-IntoR-implementation error.

Each Prefer* derive declares an inherent associated const with the same self-describing name in an impl #name block. A type carries exactly one representation default, so a second Prefer* derive makes rustc report a duplicate definitions with name ... error (E0592) — and the duplicated identifier itself spells out the fix: pick one type-level default, or choose a representation per return value at the call site via the As* wrappers (AsList, AsExternalPtr, AsDataFrame, …).

This fires regardless of derive order and without any cross-derive attribute inspection — each derive only needs to know its own fixed marker name. (The raw E0119 on IntoR may still co-fire; the duplicate-marker error is the actionable one because its identifier names both the conflict and the remedy.)