diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2019-05-20 11:46:44 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2019-05-20 11:46:44 -0700 |
| commit | d320c7ceab4371e6fd508a1f79742be042d97d2d (patch) | |
| tree | 17b9fcda4c83cf8fe96b82c52a3e6ea791fb1631 | |
| parent | 1962adea6ad9b992516ae56ad7f8c5bc33b951cb (diff) | |
| download | rust-d320c7ceab4371e6fd508a1f79742be042d97d2d.tar.gz rust-d320c7ceab4371e6fd508a1f79742be042d97d2d.zip | |
Do not fail on child without DefId
| -rw-r--r-- | src/librustc_metadata/cstore_impl.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs index 087256a9710..e6710d668dc 100644 --- a/src/librustc_metadata/cstore_impl.rs +++ b/src/librustc_metadata/cstore_impl.rs @@ -355,20 +355,20 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { return; } - let child = child.res.def_id(); - - match visible_parent_map.entry(child) { - Entry::Occupied(mut entry) => { - // If `child` is defined in crate `cnum`, ensure - // that it is mapped to a parent in `cnum`. - if child.krate == cnum && entry.get().krate != cnum { + if let Some(child) = child.res.opt_def_id() { + match visible_parent_map.entry(child) { + Entry::Occupied(mut entry) => { + // If `child` is defined in crate `cnum`, ensure + // that it is mapped to a parent in `cnum`. + if child.krate == cnum && entry.get().krate != cnum { + entry.insert(parent); + } + } + Entry::Vacant(entry) => { entry.insert(parent); + bfs_queue.push_back(child); } } - Entry::Vacant(entry) => { - entry.insert(parent); - bfs_queue.push_back(child); - } } }; |
