Expand description
Lightweight graph-based compilation safety checks.
This module provides fast pre-mutation validation using the existing
CodeGraph and SymbolRegistry infrastructure. It’s not a full type checker,
but catches common mutation errors quickly.
§Design Philosophy
- Speed over completeness: 10-100x faster than
cargo check - Leverage existing infrastructure: Uses
CodeGraphedges andSymbolRegistry - Fail fast: Catch obvious errors before expensive compilation
§Capabilities
- Symbol existence checks
- Known trait implementation verification
- Derive possibility checks (field types implement required traits)
- Borrow conflict analysis (via
DataFlowGraphV2::borrow_analysis())
§Limitations
Cannot handle: generics resolution, type inference, complex lifetimes.
Use cargo check for final validation.
§Usage
ⓘ
use ryo_analysis::{GraphChecker, CodeGraph, SymbolRegistry};
let checker = GraphChecker::new(&graph, &typeflow, ®istry);
// Quick symbol existence check
if checker.check_symbol_exists("MyStruct") {
// Symbol exists
}
// Check if derive is possible
match checker.check_derive_possible("MyStruct", "Default") {
CheckResult::Ok => { /* proceed with mutation */ }
CheckResult::Error(errors) => { /* abort or cascade */ }
_ => {}
}
// Borrow conflict detection: use BorrowTrackerV2.conflicts() directly
let tracker = dataflow.borrow_tracker();
let conflicts = tracker.conflicts(var_id, BorrowKind::Mutable, 10);Structs§
- Cascade
Result - Result of a cascade operation.
- Check
Warning - Warning from a light check.
- Graph
Checker - Lightweight graph-based checker for pre-mutation validation.
Enums§
- Cascade
Mutation - A mutation to be applied as part of cascade.
- Cascade
Status - Status of cascade operation.
- Cascade
Strategy - Strategy for handling cascade failures.
- Check
Error - Error from a light check.
- Check
Result - Result of a lightweight graph-based check.
Traits§
- Light
Check - Trait for lightweight graph-based validation.
Functions§
- cascade_
add_ derive - Cascade derive to dependent types.