Safety and Technical Notes in Melior
mainUsers should be aware of the following technical constraints and safety considerations:
Ownership and Borrowing
- Melior uses
&Tinstead of&mut Tfor MLIR objects to manage the loose ownership model of the MLIR C API. - Warning: IR object references returned from functions that move ownership of arguments (e.g.,
Region::append_block()) might become invalid later because the API uses&selfrather than&mut selfto return them.
Dialects and Runtime Errors
- Accessing operations, types, or attributes belonging to dialects that are not loaded in the current
Contextcan lead to runtime errors or segmentation faults.
String Encoding
- Only UTF-8 is supported for string encoding. Most string conversions between Rust and C are cached internally.