Skip to main content

check_s7_shortcut_collisions

Function check_s7_shortcut_collisions 

Source
fn check_s7_shortcut_collisions(parsed: &ParsedImpl) -> Result<()>
Expand description

Detect S7 fast-path shortcut name collisions within an inherent impl block.

The S7 generator (s7_class) emits a standalone <ClassName>_<method> shortcut function for each non-fallback, non-no_shortcut instance method, and a <ClassName>_<r_method_name> function for each static method. These share one R namespace, so two definitions with the same name silently clobber each other (last write wins). This typically arises from an r_name override that aliases an instance shortcut onto a static method (or vice versa).

Returns an error pointing at the offending method, advising the user to rename (via r_name) or opt the instance method out with #[miniextendr(s7(no_shortcut))]. Non-S7 class systems are a no-op.

Note: collisions with #[derive(ExternalPtr)] sidecar accessors (<ClassName>_get_<field> / _set_<field>) are not detected here — the sidecar field names live in the derive’s distributed-slice registry and are not visible to this macro invocation. See #991 for the write-time check.