pub(super) fn trait_namespace_target(
class_system: ClassSystem,
type_ident: &Ident,
trait_name: &Ident,
member: &str,
) -> StringExpand description
R-visible assignment target for a trait member (method or const) placed in
the per-class trait namespace — the single owner of the namespace-shape
policy the 5 generators previously hand-rolled independently (audit
2026-07-03-dogfooding-macros-codegen.md finding #1; #1141). member is
the R-facing method/const name.
Policy:
- Env / S3 / R6 / Vctrs:
Type$Trait$member— class-scoped, so it is collision-free by construction. This is what fixes #1115: two R6 impls of one trait on different types now emitTypeA$Trait$m/TypeB$Trait$mrather than a shared, unqualifiedr6_trait_Trait_mthat aborted wrapper-gen via the duplicate-definition guard. - S4: flat
Type_Trait_memberstandalone name. S4 objects intercept$<-, soType$Trait$membercannot be assigned onto them; the class component in the flat name keeps it collision-free. - S7:
env_var$member, whereenv_var=trait_namespace_env_var(.Type__Trait) is a local env attached toTypeviaattr()at the end of the generator. S7 objects also intercept$<-; routing through an attribute-attached env letsType$Trait$memberstill resolve at the call site (R’s$on an S7 object falls through to attributes).