diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2015-09-30 08:33:22 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2015-10-01 10:43:07 -0400 |
| commit | 52a02832b8d97226eae9f3baac671dc5b562d332 (patch) | |
| tree | 904c98bc2a686d0779bc549625de73007fc874db | |
| parent | 01f32ace0302373fb69ef9e2d0e21cc841981eba (diff) | |
| download | rust-52a02832b8d97226eae9f3baac671dc5b562d332.tar.gz rust-52a02832b8d97226eae9f3baac671dc5b562d332.zip | |
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`
| -rw-r--r-- | src/librustc/middle/const_eval.rs | 27 | ||||
| -rw-r--r-- | src/librustc/middle/ty/context.rs | 2 |
2 files changed, 1 insertions, 28 deletions
diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs index 91d9f70aee9..2d74525e4ed 100644 --- a/src/librustc/middle/const_eval.rs +++ b/src/librustc/middle/const_eval.rs @@ -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 } } diff --git a/src/librustc/middle/ty/context.rs b/src/librustc/middle/ty/context.rs index 906ff5b2656..e506e5b2c07 100644 --- a/src/librustc/middle/ty/context.rs +++ b/src/librustc/middle/ty/context.rs @@ -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()), |
