Skip to content

Commit

Permalink
Rollup merge of rust-lang#59781 - whitfin:issue-59378, r=oli-obk
Browse files Browse the repository at this point in the history
Remove check_match from const_eval

This fixes rust-lang#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!
  • Loading branch information
Centril authored Apr 12, 2019
2 parents 9a612b2 + d4d2317 commit 1fb4837
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 28 deletions.
19 changes: 3 additions & 16 deletions src/librustc_mir/const_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-23302-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-23302-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-36163.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion src/test/ui/issues/issue-51714.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
8 changes: 0 additions & 8 deletions src/test/ui/issues/issue-51714.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

0 comments on commit 1fb4837

Please sign in to comment.