Skip to content

Commit

Permalink
allow missing defs
Browse files Browse the repository at this point in the history
Looks like sometimes this is a valid thing. I notice in particular,
implementations of Iterator have two child items, one for the `next()`
method, and another for the Item type, which sometimes doesn't have a
corresponding def. I feel like this shouldn't happen, but if nothing can
be done about it, allow callers to ignore it.
  • Loading branch information
wfraser committed Jul 7, 2020
1 parent 232cdbf commit 111a8a7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,12 @@ impl Analysis {
index: id.index,
})
}
Some(self.try_get_crate(crate_id)?
self.try_get_crate(crate_id)?
.inner
.analysis
.defs
.iter()
.find(|def| def.id == id)
.unwrap_or_else(|| panic!("invalid def ID {:?} for crate {:?}", id, crate_id)))
}

pub fn impls<'a>(&'a self, crate_id: &CrateId, parent_id: rls_data::Id)
Expand Down

0 comments on commit 111a8a7

Please sign in to comment.