Skip to content

Commit 09d6a65

Browse files
authored
Rollup merge of #69166 - JohnTitor:ice-const-enum, r=matthewjasper
Check `has_typeck_tables` before calling `typeck_tables_of` Fixes #68684 r? @matthewjasper
2 parents c115ad9 + be92200 commit 09d6a65

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/librustc_mir/const_eval/eval_queries.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,10 @@ pub fn const_eval_raw_provider<'tcx>(
288288
let cid = key.value;
289289
let def_id = cid.instance.def.def_id();
290290

291-
if def_id.is_local() && tcx.typeck_tables_of(def_id).tainted_by_errors {
291+
if def_id.is_local()
292+
&& tcx.has_typeck_tables(def_id)
293+
&& tcx.typeck_tables_of(def_id).tainted_by_errors
294+
{
292295
return Err(ErrorHandled::Reported);
293296
}
294297

src/test/ui/consts/issue-68684.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// check-pass
2+
3+
enum _Enum {
4+
A(),
5+
}
6+
7+
type _E = _Enum;
8+
9+
const fn _a() -> _Enum {
10+
_E::A()
11+
}
12+
13+
const _A: _Enum = _a();
14+
15+
fn main() {}

0 commit comments

Comments
 (0)