mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
internal: Make block_def_map infallible
This commit is contained in:
parent
10e0aaf284
commit
c32d51979d
9 changed files with 32 additions and 60 deletions
|
@ -101,13 +101,7 @@ pub struct ModuleId {
|
|||
impl ModuleId {
|
||||
pub fn def_map(&self, db: &dyn db::DefDatabase) -> Arc<DefMap> {
|
||||
match self.block {
|
||||
Some(block) => {
|
||||
db.block_def_map(block).unwrap_or_else(|| {
|
||||
// NOTE: This should be unreachable - all `ModuleId`s come from their `DefMap`s,
|
||||
// so the `DefMap` here must exist.
|
||||
unreachable!("no `block_def_map` for `ModuleId` {:?}", self);
|
||||
})
|
||||
}
|
||||
Some(block) => db.block_def_map(block),
|
||||
None => db.crate_def_map(self.krate),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue