mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-03 02:23:20 +00:00
Fix ICE with unknown defids
This commit is contained in:
parent
3d9a7d9140
commit
f3fdbd0d89
@ -43,20 +43,21 @@ impl EnumGlobUse {
|
||||
}
|
||||
if let ItemUse(ref item_use) = item.node {
|
||||
if let ViewPath_::ViewPathGlob(_) = item_use.node {
|
||||
let def = cx.tcx.def_map.borrow()[&item.id];
|
||||
if let Some(node_id) = cx.tcx.map.as_local_node_id(def.def_id()) {
|
||||
if let Some(NodeItem(it)) = cx.tcx.map.find(node_id) {
|
||||
if let ItemEnum(..) = it.node {
|
||||
span_lint(cx, ENUM_GLOB_USE, item.span, "don't use glob imports for enum variants");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if let Some(dp) = cx.sess().cstore.def_path(def.def_id()).last() {
|
||||
if let DefPathData::Type(_) = dp.data {
|
||||
if let TyEnum(..) = cx.sess().cstore.item_type(&cx.tcx, def.def_id()).ty.sty {
|
||||
if let Some(def) = cx.tcx.def_map.borrow().get(&item.id) {
|
||||
if let Some(node_id) = cx.tcx.map.as_local_node_id(def.def_id()) {
|
||||
if let Some(NodeItem(it)) = cx.tcx.map.find(node_id) {
|
||||
if let ItemEnum(..) = it.node {
|
||||
span_lint(cx, ENUM_GLOB_USE, item.span, "don't use glob imports for enum variants");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if let Some(dp) = cx.sess().cstore.def_path(def.def_id()).last() {
|
||||
if let DefPathData::Type(_) = dp.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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user