diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-04-12 20:36:05 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-04-12 20:36:05 +0200 |
| commit | 1fb4837bb6035ad6d482ee7c368e5bd17b5c5093 (patch) | |
| tree | 50f0c253c4db30c145b5e6d059ed97d35d553e94 | |
| parent | 9a612b2348212d84fa0b839a4c18e4a13fafaf05 (diff) | |
| parent | d4d2317e0255a142b611ed6cd6d3fd0e233826ff (diff) | |
Rollup merge of #59781 - whitfin:issue-59378, r=oli-obk
Remove check_match from const_eval This fixes #59378. It seems that the `check_match` may be unnecessary, so this removes it per instructions provided in the issue. I re-ran the tests for `librustc_mir` and everything seemed fine!
| -rw-r--r-- | src/librustc_mir/const_eval.rs | 19 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-23302-1.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-23302-2.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-36163.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-51714.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-51714.stderr | 8 |
6 files changed, 6 insertions, 28 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| { diff --git a/src/test/ui/issues/issue-23302-1.stderr b/src/test/ui/issues/issue-23302-1.stderr index 43effc0b3b9..bbdb13a9500 100644 --- a/src/test/ui/issues/issue-23302-1.stderr +++ b/src/test/ui/issues/issue-23302-1.stderr @@ -5,7 +5,7 @@ LL | A = X::A as isize, | ^^^^^^^^^^^^^ | = note: ...which again requires processing `X::A::{{constant}}#0`, completing the cycle -note: cycle used when const-evaluating `X::A::{{constant}}#0` +note: cycle used when processing `X::A::{{constant}}#0` --> $DIR/issue-23302-1.rs:4:9 | LL | A = X::A as isize, diff --git a/src/test/ui/issues/issue-23302-2.stderr b/src/test/ui/issues/issue-23302-2.stderr index 707d4fa7ed3..03afd82211a 100644 --- a/src/test/ui/issues/issue-23302-2.stderr +++ b/src/test/ui/issues/issue-23302-2.stderr @@ -5,7 +5,7 @@ LL | A = Y::B as isize, | ^^^^^^^^^^^^^ | = note: ...which again requires processing `Y::A::{{constant}}#0`, completing the cycle -note: cycle used when const-evaluating `Y::A::{{constant}}#0` +note: cycle used when processing `Y::A::{{constant}}#0` --> $DIR/issue-23302-2.rs:4:9 | LL | A = Y::B as isize, diff --git a/src/test/ui/issues/issue-36163.stderr b/src/test/ui/issues/issue-36163.stderr index 4c3f726180d..50e8cf6e88c 100644 --- a/src/test/ui/issues/issue-36163.stderr +++ b/src/test/ui/issues/issue-36163.stderr @@ -10,7 +10,7 @@ note: ...which requires processing `A`... LL | const A: isize = Foo::B as isize; | ^^^^^^^^^^^^^^^ = note: ...which again requires processing `Foo::B::{{constant}}#0`, completing the cycle -note: cycle used when const-evaluating `Foo::B::{{constant}}#0` +note: cycle used when processing `Foo::B::{{constant}}#0` --> $DIR/issue-36163.rs:4:9 | LL | B = A, diff --git a/src/test/ui/issues/issue-51714.rs b/src/test/ui/issues/issue-51714.rs index 4885e4a2db7..0dc588d75c6 100644 --- a/src/test/ui/issues/issue-51714.rs +++ b/src/test/ui/issues/issue-51714.rs @@ -10,5 +10,4 @@ fn main() { [(); return while let Some(n) = Some(0) {}]; //~^ ERROR return statement outside of function body - //~^^ WARN irrefutable while-let pattern } diff --git a/src/test/ui/issues/issue-51714.stderr b/src/test/ui/issues/issue-51714.stderr index df11f6b7f5a..023d9013ab4 100644 --- a/src/test/ui/issues/issue-51714.stderr +++ b/src/test/ui/issues/issue-51714.stderr @@ -22,14 +22,6 @@ error[E0572]: return statement outside of function body LL | [(); return while let Some(n) = Some(0) {}]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: irrefutable while-let pattern - --> $DIR/issue-51714.rs:11:17 - | -LL | [(); return while let Some(n) = Some(0) {}]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: #[warn(irrefutable_let_patterns)] on by default - error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0572`. |
