3 ms·
Inside rustc, MIR is a data structure. The outputs you see here are a human-readable export of that, the compiler does not emit text and then re-parse. Project
by steveklabnik 11y ago
Inside rustc, MIR is a data structure. The outputs you see here are a human-readable export of that, the compiler does not emit text and then re-parse.
Projects in Rust, like miri, hook directly into the compiler and use the datastructures as well, they don't parse the output you see here: https://github.com/tsion/miri/blob/master/src/bin/miri.rs https://github.com/tsion/miri/blob/master/src/bin/miri.rs
(The post has been amended to try to clear this up a bit)
- sievebrain 11y agoThat's certainly true today, but other ecosystems have benefited tremendously from tools that are able to work directly with the IR (well, bytecode). Usually to pull off features that can't be expressed directly in the language without huge pain, like continuations, or to do things like profiling. I understand the desire to keep MIR private and avoid needing to stabilise a syntax and feature set for it, but there are benefits to doing so as well.
- steveklabnik 11y agoYes, but at the time that we actually do stabilize such a thing, we could choose a representation that looks completely different than this one, one that would be easier to parse.