From bd7a8020cc7530f21006154d130c0896b6c47c9a Mon Sep 17 00:00:00 2001 From: Isaac Whitfield Date: Sat, 6 Apr 2019 17:25:44 -0700 Subject: [PATCH] Remove check_match from const_eval --- src/librustc_mir/const_eval.rs | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/librustc_mir/const_eval.rs b/src/librustc_mir/const_eval.rs index 33715b749f9..4c8ab361e04 100644 --- a/src/librustc_mir/const_eval.rs +++ b/src/librustc_mir/const_eval.rs @@ -615,22 +615,9 @@ pub fn const_eval_raw_provider<'a, 'tcx>( let cid = key.value; let def_id = cid.instance.def.def_id(); - if let Some(id) = tcx.hir().as_local_hir_id(def_id) { - let tables = tcx.typeck_tables_of(def_id); - - // Do match-check before building MIR - // FIXME(#59378) check_match may have errored but we're not checking for that anymore - tcx.check_match(def_id); - - if let hir::BodyOwnerKind::Const = tcx.hir().body_owner_kind_by_hir_id(id) { - tcx.mir_const_qualif(def_id); - } - - // Do not continue into miri if typeck errors occurred; it will fail horribly - if tables.tainted_by_errors { - return Err(ErrorHandled::Reported) - } - }; + if def_id.is_local() && tcx.typeck_tables_of(def_id).tainted_by_errors { + return Err(ErrorHandled::Reported); + } let (res, ecx) = eval_body_and_ecx(tcx, cid, None, key.param_env); res.and_then(|place| {