Note that BasicBlock is just an index

This commit is contained in:
Camelid 2020-10-16 20:35:56 -07:00
parent f1b97ee7f8
commit 91ba04d872

View file

@ -146,7 +146,7 @@ impl<'tcx> MirSource<'tcx> {
/// The lowered representation of a single function.
#[derive(Clone, TyEncodable, TyDecodable, Debug, HashStable, TypeFoldable)]
pub struct Body<'tcx> {
/// A list of basic blocks. References to basic block use a newtyped index type `BasicBlock`
/// A list of basic blocks. References to basic block use a newtyped index type [`BasicBlock`]
/// that indexes into this vector.
basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
@ -1106,6 +1106,9 @@ rustc_index::newtype_index! {
/// are edges that go from a multi-successor node to a multi-predecessor node. This pass is
/// needed because some analyses require that there are no critical edges in the CFG.
///
/// Note that this type is just an index into [`Body.basic_blocks`](Body::basic_blocks);
/// the actual data that a basic block holds is in [`BasicBlockData`].
///
/// Read more about basic blocks in the [rustc-dev-guide][guide-mir].
///
/// [CFG]: https://rustc-dev-guide.rust-lang.org/appendix/background.html#cfg