summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-02-15 09:45:48 +0100
committerGitHub <noreply@github.com>2020-02-15 09:45:48 +0100
commit09d6a657b1396d8ed9ce052df4a45d4ef47fa608 (patch)
tree3cec0a048d7d02d17c656feb8f21cd9f7d2b0aed
parentRollup merge of #69154 - JohnTitor:fix-macro-ices, r=petrochenkov (diff)
parentCheck `has_typeck_tables` before calling `typeck_tables_of` (diff)
downloadrust-09d6a657b1396d8ed9ce052df4a45d4ef47fa608.tar.gz
rust-09d6a657b1396d8ed9ce052df4a45d4ef47fa608.tar.bz2
rust-09d6a657b1396d8ed9ce052df4a45d4ef47fa608.tar.xz
Rollup merge of #69166 - JohnTitor:ice-const-enum, r=matthewjasper
Check `has_typeck_tables` before calling `typeck_tables_of` Fixes #68684 r? @matthewjasper
-rw-r--r--src/librustc_mir/const_eval/eval_queries.rs5
-rw-r--r--src/test/ui/consts/issue-68684.rs15
2 files changed, 19 insertions, 1 deletions
diff --git a/src/librustc_mir/const_eval/eval_queries.rs b/src/librustc_mir/const_eval/eval_queries.rs
index 2e8e4da..4fdabed 100644
--- a/src/librustc_mir/const_eval/eval_queries.rs
+++ b/src/librustc_mir/const_eval/eval_queries.rs
@@ -288,7 +288,10 @@ pub fn const_eval_raw_provider<'tcx>(
288 let cid = key.value; 288 let cid = key.value;
289 let def_id = cid.instance.def.def_id(); 289 let def_id = cid.instance.def.def_id();
290 290
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 {
292 return Err(ErrorHandled::Reported); 295 return Err(ErrorHandled::Reported);
293 } 296 }
294 297
diff --git a/src/test/ui/consts/issue-68684.rs b/src/test/ui/consts/issue-68684.rs
new file mode 100644
index 0000000..c98f199
--- /dev/null
+++ b/src/test/ui/consts/issue-68684.rs
@@ -0,0 +1,15 @@
1// check-pass
2
3enum _Enum {
4 A(),
5}
6
7type _E = _Enum;
8
9const fn _a() -> _Enum {
10 _E::A()
11}
12
13const _A: _Enum = _a();
14
15fn main() {}