Replace &Vec<_>
s with &[_]
s
This commit is contained in:
parent
e40d5e83dc
commit
afaa9854fa
14 changed files with 53 additions and 45 deletions
|
@ -16,6 +16,7 @@ use rustc_query_system::ich::StableHashingContext;
|
|||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
||||
use std::fmt;
|
||||
use std::ops::Deref;
|
||||
|
||||
/// Represents a statically-describable scope that can be used to
|
||||
/// bound the lifetime/region for values.
|
||||
|
@ -407,8 +408,8 @@ impl ScopeTree {
|
|||
|
||||
/// Checks whether the given scope contains a `yield`. If so,
|
||||
/// returns `Some(YieldData)`. If not, returns `None`.
|
||||
pub fn yield_in_scope(&self, scope: Scope) -> Option<&Vec<YieldData>> {
|
||||
self.yield_in_scope.get(&scope)
|
||||
pub fn yield_in_scope(&self, scope: Scope) -> Option<&[YieldData]> {
|
||||
self.yield_in_scope.get(&scope).map(Deref::deref)
|
||||
}
|
||||
|
||||
/// Gives the number of expressions visited in a body.
|
||||
|
|
|
@ -310,7 +310,7 @@ pub fn reachable_as_bitset<'tcx>(body: &Body<'tcx>) -> BitSet<BasicBlock> {
|
|||
#[derive(Clone)]
|
||||
pub struct ReversePostorderIter<'a, 'tcx> {
|
||||
body: &'a Body<'tcx>,
|
||||
blocks: &'a Vec<BasicBlock>,
|
||||
blocks: &'a [BasicBlock],
|
||||
idx: usize,
|
||||
}
|
||||
|
||||
|
@ -358,9 +358,9 @@ impl PostorderCache {
|
|||
self.cache = OnceCell::new();
|
||||
}
|
||||
|
||||
/// Returns the &Vec<BasicBlocks> 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<BasicBlock> {
|
||||
pub(super) fn compute(&self, body: &Body<'_>) -> &[BasicBlock] {
|
||||
self.cache.get_or_init(|| Postorder::new(body, START_BLOCK).map(|(bb, _)| bb).collect())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1032,6 +1032,13 @@ impl<'tcx, T> Binder<'tcx, T> {
|
|||
Binder(&self.0, self.1)
|
||||
}
|
||||
|
||||
pub fn as_deref(&self) -> Binder<'tcx, &T::Target>
|
||||
where
|
||||
T: Deref,
|
||||
{
|
||||
Binder(&self.0, self.1)
|
||||
}
|
||||
|
||||
pub fn map_bound_ref_unchecked<F, U>(&self, f: F) -> Binder<'tcx, U>
|
||||
where
|
||||
F: FnOnce(&T) -> U,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue