]> git.lizzy.rs Git - rust.git/commitdiff
libpanic_unwind => 2018: fix ICEs.
authorMazdak Farrokhzad <twingoow@gmail.com>
Tue, 12 Feb 2019 23:07:22 +0000 (00:07 +0100)
committerMazdak Farrokhzad <twingoow@gmail.com>
Wed, 13 Feb 2019 17:09:09 +0000 (18:09 +0100)
src/librustc_typeck/check/method/suggest.rs
src/librustdoc/visit_lib.rs

index aa6f73b29b4b585fddbf6254242e3f16cbd17f58..b3248018b5529b5a4caaf721f40c702b29a05f1d 100644 (file)
@@ -752,12 +752,11 @@ fn handle_external_def(tcx: TyCtxt,
                            traits: &mut Vec<DefId>,
                            external_mods: &mut FxHashSet<DefId>,
                            def: Def) {
-        let def_id = def.def_id();
         match def {
-            Def::Trait(..) => {
+            Def::Trait(def_id) => {
                 traits.push(def_id);
             }
-            Def::Mod(..) => {
+            Def::Mod(def_id) => {
                 if !external_mods.insert(def_id) {
                     return;
                 }
index 7413a917f056325c9a457e4a24f970c51ff753f5..bd5cae861e93b4228e954d3f5955754fa25d66b8 100644 (file)
@@ -60,9 +60,11 @@ pub fn visit_mod(&mut self, def_id: DefId) {
         }
 
         for item in self.cx.tcx.item_children(def_id).iter() {
-            if self.cx.tcx.def_key(item.def.def_id()).parent.map_or(false, |d| d == def_id.index) ||
-                item.vis == Visibility::Public {
-                self.visit_item(item.def);
+            if let Some(def_id) = item.def.opt_def_id() {
+                if self.cx.tcx.def_key(def_id).parent.map_or(false, |d| d == def_id.index) ||
+                    item.vis == Visibility::Public {
+                    self.visit_item(item.def);
+                }
             }
         }
     }