convert the creepy case to just return None -- in practice, it would
have always been returning None anyway, since it was comparing node-ids across crates incorrectly -- and remove the now unused map `extern_const_variants`
This commit is contained in:
parent
01f32ace03
commit
52a02832b8
@ -82,32 +82,7 @@ fn lookup_variant_by_id<'a>(tcx: &'a ty::ctxt,
|
||||
Some(_) => None
|
||||
}
|
||||
} else {
|
||||
match tcx.extern_const_variants.borrow().get(&variant_def) {
|
||||
Some(&ast::DUMMY_NODE_ID) => return None,
|
||||
Some(&expr_id) => {
|
||||
return Some(tcx.map.expect_expr(expr_id));
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
let expr_id = match
|
||||
csearch::maybe_get_item_ast(
|
||||
tcx, enum_def,
|
||||
Box::new(|a, b, c, d, e| astencode::decode_inlined_item(a, b, c, d, e)))
|
||||
{
|
||||
csearch::FoundAst::Found(&InlinedItem::Item(ref item)) => match item.node {
|
||||
hir::ItemEnum(hir::EnumDef { .. }, _) => {
|
||||
tcx.sess.span_bug(
|
||||
item.span,
|
||||
&format!("cross-crate enum discr constant with enum {:?} variant {:?}",
|
||||
enum_def, variant_def));
|
||||
}
|
||||
_ => None
|
||||
},
|
||||
_ => None
|
||||
};
|
||||
tcx.extern_const_variants.borrow_mut().insert(variant_def,
|
||||
expr_id.unwrap_or(ast::DUMMY_NODE_ID));
|
||||
expr_id.map(|id| tcx.map.expect_expr(id))
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -307,7 +307,6 @@ pub struct ctxt<'tcx> {
|
||||
|
||||
/// These caches are used by const_eval when decoding external constants.
|
||||
pub extern_const_statics: RefCell<DefIdMap<NodeId>>,
|
||||
pub extern_const_variants: RefCell<DefIdMap<NodeId>>,
|
||||
pub extern_const_fns: RefCell<DefIdMap<NodeId>>,
|
||||
|
||||
pub node_lint_levels: RefCell<FnvHashMap<(NodeId, lint::LintId),
|
||||
@ -500,7 +499,6 @@ impl<'tcx> ctxt<'tcx> {
|
||||
populated_external_types: RefCell::new(DefIdSet()),
|
||||
populated_external_primitive_impls: RefCell::new(DefIdSet()),
|
||||
extern_const_statics: RefCell::new(DefIdMap()),
|
||||
extern_const_variants: RefCell::new(DefIdMap()),
|
||||
extern_const_fns: RefCell::new(DefIdMap()),
|
||||
node_lint_levels: RefCell::new(FnvHashMap()),
|
||||
transmute_restrictions: RefCell::new(Vec::new()),
|
||||
|
Loading…
x
Reference in New Issue
Block a user