Skip to content

Commit 1fb4837

Browse files
authored
Rollup merge of rust-lang#59781 - whitfin:issue-59378, r=oli-obk
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!
2 parents 9a612b2 + d4d2317 commit 1fb4837

File tree

6 files changed

+6
-28
lines changed

6 files changed

+6
-28
lines changed

src/librustc_mir/const_eval.rs

+3-16
Original file line numberDiff line numberDiff line change
@@ -615,22 +615,9 @@ pub fn const_eval_raw_provider<'a, 'tcx>(
615615
let cid = key.value;
616616
let def_id = cid.instance.def.def_id();
617617

618-
if let Some(id) = tcx.hir().as_local_hir_id(def_id) {
619-
let tables = tcx.typeck_tables_of(def_id);
620-
621-
// Do match-check before building MIR
622-
// FIXME(#59378) check_match may have errored but we're not checking for that anymore
623-
tcx.check_match(def_id);
624-
625-
if let hir::BodyOwnerKind::Const = tcx.hir().body_owner_kind_by_hir_id(id) {
626-
tcx.mir_const_qualif(def_id);
627-
}
628-
629-
// Do not continue into miri if typeck errors occurred; it will fail horribly
630-
if tables.tainted_by_errors {
631-
return Err(ErrorHandled::Reported)
632-
}
633-
};
618+
if def_id.is_local() && tcx.typeck_tables_of(def_id).tainted_by_errors {
619+
return Err(ErrorHandled::Reported);
620+
}
634621

635622
let (res, ecx) = eval_body_and_ecx(tcx, cid, None, key.param_env);
636623
res.and_then(|place| {

src/test/ui/issues/issue-23302-1.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | A = X::A as isize,
55
| ^^^^^^^^^^^^^
66
|
77
= note: ...which again requires processing `X::A::{{constant}}#0`, completing the cycle
8-
note: cycle used when const-evaluating `X::A::{{constant}}#0`
8+
note: cycle used when processing `X::A::{{constant}}#0`
99
--> $DIR/issue-23302-1.rs:4:9
1010
|
1111
LL | A = X::A as isize,

src/test/ui/issues/issue-23302-2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | A = Y::B as isize,
55
| ^^^^^^^^^^^^^
66
|
77
= note: ...which again requires processing `Y::A::{{constant}}#0`, completing the cycle
8-
note: cycle used when const-evaluating `Y::A::{{constant}}#0`
8+
note: cycle used when processing `Y::A::{{constant}}#0`
99
--> $DIR/issue-23302-2.rs:4:9
1010
|
1111
LL | A = Y::B as isize,

src/test/ui/issues/issue-36163.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ note: ...which requires processing `A`...
1010
LL | const A: isize = Foo::B as isize;
1111
| ^^^^^^^^^^^^^^^
1212
= note: ...which again requires processing `Foo::B::{{constant}}#0`, completing the cycle
13-
note: cycle used when const-evaluating `Foo::B::{{constant}}#0`
13+
note: cycle used when processing `Foo::B::{{constant}}#0`
1414
--> $DIR/issue-36163.rs:4:9
1515
|
1616
LL | B = A,

src/test/ui/issues/issue-51714.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ fn main() {
1010

1111
[(); return while let Some(n) = Some(0) {}];
1212
//~^ ERROR return statement outside of function body
13-
//~^^ WARN irrefutable while-let pattern
1413
}

src/test/ui/issues/issue-51714.stderr

-8
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@ error[E0572]: return statement outside of function body
2222
LL | [(); return while let Some(n) = Some(0) {}];
2323
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2424

25-
warning: irrefutable while-let pattern
26-
--> $DIR/issue-51714.rs:11:17
27-
|
28-
LL | [(); return while let Some(n) = Some(0) {}];
29-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30-
|
31-
= note: #[warn(irrefutable_let_patterns)] on by default
32-
3325
error: aborting due to 4 previous errors
3426

3527
For more information about this error, try `rustc --explain E0572`.

0 commit comments

Comments
 (0)