pub fn compile_to_rust_checked(source: &str) -> Result<String, ParseError>Expand description
Compile LOGOS source to Rust with ownership checking enabled.
This runs the lightweight ownership analysis pass that catches use-after-move errors with control flow awareness. The analysis is fast enough to run on every keystroke in an IDE.
§Arguments
source- LOGOS source code as a string
§Returns
Generated Rust source code on success.
§Errors
Returns ParseError if:
- Any error from
compile_to_rustoccurs - Ownership analysis detects use-after-move
- Ownership analysis detects use-after-borrow violations
§Example
// This will fail ownership checking
let source = "## Main\nLet x be 5.\nGive x to y.\nShow x.";
let result = compile_to_rust_checked(source);
assert!(result.is_err()); // "x has already been given away"§Use Case
Use this function with the --check CLI flag for instant feedback on
ownership errors before running the full Rust compilation.