diff options
| author | Prashant-Shekhar-Rao <139104389+Prashant-Shekhar-Rao@users.noreply.github.com> | 2023-09-07 19:18:37 +0530 |
|---|---|---|
| committer | Tshepang Mbambo <tshepang@gmail.com> | 2023-09-08 12:59:13 +0200 |
| commit | e2cc9c817763b1ea4fe83bbc6a33cce642fd7633 (patch) | |
| tree | 3b8d2d1a52a4ad4af202eb259d59a9fe4185868b /src | |
| parent | 88b4ea1932ba9abe87727eaf920b970885e36517 (diff) | |
| download | rust-e2cc9c817763b1ea4fe83bbc6a33cce642fd7633.tar.gz rust-e2cc9c817763b1ea4fe83bbc6a33cce642fd7633.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc/rustc-dev-guide/src/mir/index.md | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/doc/rustc-dev-guide/src/mir/index.md b/src/doc/rustc-dev-guide/src/mir/index.md index dc0be167b01..b90c5ad83b7 100644 --- a/src/doc/rustc-dev-guide/src/mir/index.md +++ b/src/doc/rustc-dev-guide/src/mir/index.md @@ -62,6 +62,12 @@ show you the MIR for your program. Try putting this program into play button on the top: [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 fn main() { |
