Module error_translator

Module error_translator 

Source
Expand description

Error translation

Translates rustc compilation errors from generated Rust code positions back to original Oxur source code positions using the SourceMap.

§Current Implementation

Stage 1.10 provides the infrastructure for error translation but doesn’t yet implement full position lookup. Error messages show:

  • The error message from rustc
  • The generated Rust file position (as fallback)
  • A note that full translation is not yet implemented

§Future Enhancement (Phase 2)

Full position translation requires a reverse index:

  • Rust Position (file:line:col) → Rust NodeId
  • Built during lowering when generating syn nodes
  • Fast lookup at error translation time

This will enable errors like:

error: cannot find value `x` in this scope
  --> example.oxur:2:8

Instead of:

error: cannot find value `x` in this scope
  --> generated.rs:5:10

Structs§

ErrorTranslator
Translates rustc error positions to Oxur source positions