|
25 | 25 | //! |
26 | 26 | //! { |
27 | 27 | //! let temp1 = x; |
28 | | -//! Goto(exit) |
| 28 | +//! Goto(my_second_block) |
29 | 29 | //! } |
30 | 30 | //! |
31 | | -//! exit = { |
| 31 | +//! my_second_block = { |
32 | 32 | //! temp2 = Move(temp1); |
33 | 33 | //! RET = temp2; |
34 | 34 | //! Return() |
|
37 | 37 | //! } |
38 | 38 | //! ``` |
39 | 39 | //! |
40 | | -//! Hopefully the syntax is fairly self-explanatory to anyone familiar with MIR. The `custom_mir` |
41 | | -//! attribute tells the compiler to treat the function as being custom MIR. This attribute only |
42 | | -//! works on functions - there is no way to insert custom MIR into the middle of another function. |
43 | | -//! The `dialect` and `phase` parameters indicate which version of MIR you are inserting here. This |
44 | | -//! will normally be the phase that corresponds to the thing you are trying to test. The phase can |
45 | | -//! be omitted for dialects that have just one. |
| 40 | +//! The `custom_mir` attribute tells the compiler to treat the function as being custom MIR. This |
| 41 | +//! attribute only works on functions - there is no way to insert custom MIR into the middle of |
| 42 | +//! another function. The `dialect` and `phase` parameters indicate which [version of MIR][dialect |
| 43 | +//! docs] you are inserting here. Generally you'll want to use `#![custom_mir(dialect = "built")]` |
| 44 | +//! if you want your MIR to be modified by the full MIR pipeline, or `#![custom_mir(dialect = |
| 45 | +//! "runtime", phase = "optimized")] if you don't. |
| 46 | +//! |
| 47 | +//! [dialect docs]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/enum.MirPhase.html |
46 | 48 | //! |
47 | 49 | //! The input to the [`mir!`] macro is: |
48 | 50 | //! |
|
159 | 161 | //! |
160 | 162 | //! # Syntax |
161 | 163 | //! |
162 | | -//! The lists below are an exahustive description of how various MIR constructs can be created. |
| 164 | +//! The lists below are an exhaustive description of how various MIR constructs can be created. |
163 | 165 | //! Anything missing from the list should be assumed to not be supported, PRs welcome. |
164 | 166 | //! |
165 | 167 | //! #### Locals |
|
171 | 173 | //! #### Places |
172 | 174 | //! - Locals implicit convert to places. |
173 | 175 | //! - Field accesses, derefs, and indexing work normally. |
174 | | -//! - Fields in variants can be accessed via the [`Variant`] and [`Field`] methods, see their |
175 | | -//! documentation for details. |
| 176 | +//! - Fields in variants can be accessed via the [`Variant`] and [`Field`] associated functions, |
| 177 | +//! see their documentation for details. |
176 | 178 | //! |
177 | 179 | //! #### Operands |
178 | 180 | //! - Places implicitly convert to `Copy` operands. |
|
0 commit comments