pub fn diff_surfaces_with_semantics<M, S>(
old: &ApiSurface<M>,
new: &ApiSurface<M>,
semantics: &S,
) -> Vec<StructuralChange>Expand description
Compare two API surfaces using language-specific semantic rules.
This is the core of the TD (Top-Down) pipeline. It matches symbols by
qualified_name, then compares every field to detect additions, removals,
and modifications.
The semantics parameter provides language-specific rules for:
- Whether adding a member is breaking (
is_member_addition_breaking) - How to group related symbols (
same_family,same_identity) - How to rank visibility levels (
visibility_rank) - How to parse union/literal types (
parse_union_values) - Post-processing of the change list (
post_process)
The matching pipeline is:
- Exact qualified_name match — symbols at the same path are compared directly.
- Relocation detection — symbols with the same canonical path (stripping
/deprecated/and/next/) are matched as path moves (e.g., moved to deprecated). - Rename detection — remaining removed+added pairs are matched by type fingerprint and name similarity.
- Unmatched — remaining removed symbols are reported as removed, added as added.
Star re-export symbols (export * from './module') are filtered out.