]> git.lizzy.rs Git - rust.git/commitdiff
Fix ICE
authorManish Goregaokar <manishsmail@gmail.com>
Sun, 27 Mar 2016 20:28:57 +0000 (01:58 +0530)
committerManish Goregaokar <manishsmail@gmail.com>
Sun, 27 Mar 2016 20:28:57 +0000 (01:58 +0530)
src/enum_glob_use.rs

index 63f5886fec89e90b3e8f6ddf18ce968edaef54af..5b29f84ef51d44eeb539a1a9f779f65a106cd72f 100644 (file)
@@ -1,9 +1,9 @@
 //! lint on `use`ing all variants of an enum
 
 use rustc::front::map::Node::NodeItem;
-use rustc::front::map::definitions::DefPathData;
 use rustc::lint::{LateLintPass, LintPass, LateContext, LintArray, LintContext};
-use rustc::ty::TyEnum;
+use rustc::middle::def::Def;
+use rustc::middle::cstore::DefLike;
 use rustc_front::hir::*;
 use syntax::ast::NodeId;
 use syntax::codemap::Span;
@@ -51,12 +51,10 @@ fn lint_item(&self, cx: &LateContext, item: &Item) {
                             }
                         }
                     } else {
-                        let dp = cx.sess().cstore.relative_def_path(def.def_id());
-                        if  let Some(dpa) = dp.data.last() {
-                            if let  DefPathData::TypeNs(_) = dpa.data {
-                                if let TyEnum(..) = cx.sess().cstore.item_type(&cx.tcx, def.def_id()).ty.sty {
-                                    span_lint(cx, ENUM_GLOB_USE, item.span, "don't use glob imports for enum variants");
-                                }
+                        let child = cx.sess().cstore.item_children(def.def_id());
+                        if let Some(child) = child.first() {
+                            if let DefLike::DlDef(Def::Variant(..)) = child.def {
+                                span_lint(cx, ENUM_GLOB_USE, item.span, "don't use glob imports for enum variants");   
                             }
                         }
                     }