Skip to content

Commit 02068c0

Browse files
Add links to the rust documentation for all MIR structs (#982)
* Add links to the rust documentation for all MIR structs * Update src/mir/index.md Co-authored-by: Léo Lanteri Thauvin <[email protected]> * Update src/mir/index.md Co-authored-by: Léo Lanteri Thauvin <[email protected]> Co-authored-by: Léo Lanteri Thauvin <[email protected]>
1 parent 55c7be5 commit 02068c0

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

src/mir/index.md

+22-11
Original file line numberDiff line numberDiff line change
@@ -221,26 +221,28 @@ function (along with sub-instances of Mir for "promoted constants",
221221
but [you can read about those below](#promoted)).
222222

223223
- **Basic blocks**: The basic blocks are stored in the field
224-
`basic_blocks`; this is a vector of `BasicBlockData`
225-
structures. Nobody ever references a basic block directly: instead,
226-
we pass around `BasicBlock` values, which are
227-
[newtype'd] indices into this vector.
228-
- **Statements** are represented by the type `Statement`.
224+
[`Body::basic_blocks`][basicblocks]; this is a vector
225+
of [`BasicBlockData`] structures. Nobody ever references a
226+
basic block directly: instead, we pass around [`BasicBlock`]
227+
values, which are [newtype'd] indices into this vector.
228+
- **Statements** are represented by the type [`Statement`].
229229
- **Terminators** are represented by the `Terminator`.
230-
- **Locals** are represented by a [newtype'd] index type `Local`. The
231-
data for a local variable is found in the `Mir` (the `local_decls`
230+
- **Locals** are represented by a [newtype'd] index type [`Local`].
231+
The data for a local variable is found in the `Mir` (the `local_decls`
232232
vector). There is also a special constant `RETURN_PLACE` identifying
233233
the special "local" representing the return value.
234-
- **Places** are identified by the enum `Place`. There are a few variants:
234+
- **Places** are identified by the enum [`Place`]. There are a few
235+
variants:
235236
- Local variables like `_1`
236237
- Static variables `FOO`
237238
- **Projections**, which are fields or other things that "project
238-
out" from a base place. So e.g. the place `_1.f` is a projection,
239+
out" from a base place. These are represented by the type
240+
[`Projection`]. So e.g. the place `_1.f` is a projection,
239241
with `f` being the "projection element and `_1` being the base
240242
path. `*_1` is also a projection, with the `*` being represented
241243
by the `ProjectionElem::Deref` element.
242-
- **Rvalues** are represented by the enum `Rvalue`.
243-
- **Operands** are represented by the enum `Operand`.
244+
- **Rvalues** are represented by the enum [`Rvalue`].
245+
- **Operands** are represented by the enum [`Operand`].
244246

245247
## Representing constants
246248

@@ -256,3 +258,12 @@ but [you can read about those below](#promoted)).
256258
[mir]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/index.html
257259
[mirmanip]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/index.html
258260
[newtype'd]: ../appendix/glossary.html#newtype
261+
[basicblocks](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/struct.Body.html#structfield.basic_blocks)
262+
[`BasicBlock`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/struct.BasicBlock.html
263+
[`BasicBlockData`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/struct.BasicBlockData.html
264+
[`Statement`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/struct.Statement.html
265+
[`Terminator`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/terminator/struct.Terminator.html
266+
[`Local`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/struct.Local.html
267+
[`Place`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/struct.Place.html
268+
[`Rvalue`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/enum.Rvalue.html
269+
[`Operand`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/enum.Operand.html

0 commit comments

Comments
 (0)