X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_middle%2Fsrc%2Fmir%2Ftraversal.rs;h=db64bcba3b111a11ed5ecbe0e7dbe0c54e96be8b;hb=afaa9854fa6df74d7a1b85ebb1f45bdcd0dcc152;hp=1cbfed621560d6a516edb278817535b54f2a03c4;hpb=38bf1158bd850c80de42599c28602ae11727a133;p=rust.git diff --git a/compiler/rustc_middle/src/mir/traversal.rs b/compiler/rustc_middle/src/mir/traversal.rs index 1cbfed62156..db64bcba3b1 100644 --- a/compiler/rustc_middle/src/mir/traversal.rs +++ b/compiler/rustc_middle/src/mir/traversal.rs @@ -310,7 +310,7 @@ pub fn reachable_as_bitset<'tcx>(body: &Body<'tcx>) -> BitSet { #[derive(Clone)] pub struct ReversePostorderIter<'a, 'tcx> { body: &'a Body<'tcx>, - blocks: &'a Vec, + blocks: &'a [BasicBlock], idx: usize, } @@ -358,9 +358,9 @@ pub(super) fn invalidate(&mut self) { self.cache = OnceCell::new(); } - /// Returns the &Vec represents the postorder graph for this MIR. + /// Returns the `&[BasicBlocks]` represents the postorder graph for this MIR. #[inline] - pub(super) fn compute(&self, body: &Body<'_>) -> &Vec { + pub(super) fn compute(&self, body: &Body<'_>) -> &[BasicBlock] { self.cache.get_or_init(|| Postorder::new(body, START_BLOCK).map(|(bb, _)| bb).collect()) } }