Use an IndexVec for bodies.
This commit is contained in:
@@ -666,7 +666,7 @@ pub struct WhereEqPredicate<'hir> {
|
||||
pub struct OwnerInfo<'hir> {
|
||||
pub node: OwnerNode<'hir>,
|
||||
pub attrs: BTreeMap<ItemLocalId, &'hir [Attribute]>,
|
||||
pub bodies: BTreeMap<ItemLocalId, Body<'hir>>,
|
||||
pub bodies: IndexVec<ItemLocalId, Option<&'hir Body<'hir>>>,
|
||||
/// Map indicating what traits are in scope for places where this
|
||||
/// is relevant; generated by resolve.
|
||||
pub trait_map: FxHashMap<ItemLocalId, Box<[TraitCandidate]>>,
|
||||
@@ -705,9 +705,9 @@ impl Crate<'hir> {
|
||||
self.owners[id.def_id].as_ref().unwrap().node.expect_foreign_item()
|
||||
}
|
||||
|
||||
pub fn body(&self, id: BodyId) -> &Body<'hir> {
|
||||
pub fn body(&self, id: BodyId) -> &'hir Body<'hir> {
|
||||
let HirId { owner, local_id } = id.hir_id;
|
||||
&self.owners[owner].as_ref().unwrap().bodies[&local_id]
|
||||
self.owners[owner].as_ref().unwrap().bodies[local_id].unwrap()
|
||||
}
|
||||
|
||||
pub fn attrs(&self, id: HirId) -> &'hir [Attribute] {
|
||||
|
||||
Reference in New Issue
Block a user