Updated index.md to add a command which can show unoptimized MIR
The current playground link used in the page of MIR shows a optimized version of MIR which is missing some statements such as StorageLive . Updated to use a local command which shows unoptimized MIR that would be more useful for pedagogical purposes.
This commit is contained in:
parent
3b0eb4cd62
commit
a5e35dd106
|
|
@ -62,6 +62,12 @@ show you the MIR for your program. Try putting this program into play
|
||||||
button on the top:
|
button on the top:
|
||||||
|
|
||||||
[sample-play]: https://play.rust-lang.org/?gist=30074856e62e74e91f06abd19bd72ece&version=stable
|
[sample-play]: https://play.rust-lang.org/?gist=30074856e62e74e91f06abd19bd72ece&version=stable
|
||||||
|
MIR shown by above link is optimized.
|
||||||
|
Some statements like `StorageLive` are removed in optimization.
|
||||||
|
This happens because compiler notices the value is never acessed in the code.
|
||||||
|
We can use `rustc [filename].rs -Z mir-opt-level=0 --emit mir` to view unoptimized MIR.
|
||||||
|
This requires the nightly toolchain.
|
||||||
|
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue