Skip to main content

target_conflicts

Function target_conflicts 

Source
pub fn target_conflicts(
    a: &MutationTargetSymbol,
    b: &MutationTargetSymbol,
) -> bool
Expand description

Check if two MutationTargetSymbols potentially conflict.

§Rules

  • ById vs ById: Compare SymbolId directly
  • ByPath vs ByPath: Compare SymbolPath directly
  • ByKindAndName vs ByKindAndName: Compare Kind + Name
  • Mixed variants: Conservative (return true = potential conflict)
  • ByAffectedId: Compare parent_id + name

§Conservative Strategy

When resolution status differs (e.g., ById vs ByPath), we conservatively assume they might conflict until both are resolved. This prevents incorrect parallel execution that could corrupt code.

§Examples

use ryo_executor::executor::target_conflicts;
use ryo_executor::MutationTargetSymbol;
use ryo_symbol::SymbolId;

let id1 = SymbolId::parse("1v1").unwrap();
let id2 = SymbolId::parse("2v1").unwrap();

// Same ID = conflict
assert!(target_conflicts(
    &MutationTargetSymbol::ById(id1),
    &MutationTargetSymbol::ById(id1)
));

// Different IDs = no conflict
assert!(!target_conflicts(
    &MutationTargetSymbol::ById(id1),
    &MutationTargetSymbol::ById(id2)
));