From aa40a1cad0f359bfc799545e70bb5c7c9e72ba93 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 3 Sep 2015 20:36:53 -0400 Subject: [PATCH] change creepy case to call span_bug instead of doing something clearly wrong --- src/librustc/middle/const_eval.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs index 4894a78f1acb4..bde81090aa01e 100644 --- a/src/librustc/middle/const_eval.rs +++ b/src/librustc/middle/const_eval.rs @@ -91,11 +91,11 @@ fn lookup_variant_by_id<'a>(tcx: &'a ty::ctxt, let expr_id = match csearch::maybe_get_item_ast(tcx, enum_def, Box::new(|a, b, c, d| astencode::decode_inlined_item(a, b, c, d))) { csearch::FoundAst::Found(&InlinedItem::Item(ref item)) => match item.node { - hir::ItemEnum(hir::EnumDef { ref variants }, _) => { - // NOTE this doesn't do the right thing, it compares inlined - // NodeId's to the original variant_def's NodeId, but they - // come from different crates, so they will likely never match. - variant_expr(&variants[..], variant_def.node).map(|e| e.id) + hir::ItemEnum(hir::EnumDef { .. }, _) => { + tcx.sess.span_bug( + item.span, + &format!("cross-crate enum discr constant with enum {:?} variant {:?}", + enum_def, variant_def)); } _ => None },