Skip to content

Commit

Permalink
change creepy case to call span_bug instead of doing something clearl…
Browse files Browse the repository at this point in the history
…y wrong
  • Loading branch information
nikomatsakis committed Oct 1, 2015
1 parent 9ff4f57 commit aa40a1c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/librustc/middle/const_eval.rs
Expand Up @@ -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
},
Expand Down

0 comments on commit aa40a1c

Please sign in to comment.