4 ms·
I'm curious how this new architecture preserves safety invariants. The post says MIR contains operations not available in Rust because they are unsafe. Does t
by haberman 11y ago
I'm curious how this new architecture preserves safety invariants. The post says MIR contains operations not available in Rust because they are unsafe. Does this mean every MIR transformation needs to be safety-preserving? Or is safety-checking the last stage that runs directly before LLVM IR generation?
- pcwalton 11y agoMIR transformations do have to be safety-preserving, but this isn't any different from all of the LLVM IR-level optimizations.
- haberman 11y agoBut the MIR definition of "safety" must be more encompassing than LLVM IR, right? LLVM IR has no concept of a borrow. Where in the MIR pipeline does borrow checking happen?
- pcwalton 11y agoI believe that when it's implemented it will happen first before any optimization, in order to provide the best diagnostics possible and to avoid doing wasted optimization if there are errors. But Niko would really be able to answer this more definitively.
- deleted 11y ago[deleted]
- pc2g4d 11y agoThat concerned me a bit, too. Seems like potentially a source of safety problems?
- pcwalton 11y agoNot any worse than LLVM optimizations are, and there are way more of those.