Skip to content

Commit

Permalink
Check has_typeck_tables before calling typeck_tables_of
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed Feb 14, 2020
1 parent 21ed505 commit be92200
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/librustc_mir/const_eval/eval_queries.rs
Expand Up @@ -288,7 +288,10 @@ pub fn const_eval_raw_provider<'tcx>(
let cid = key.value;
let def_id = cid.instance.def.def_id();

if def_id.is_local() && tcx.typeck_tables_of(def_id).tainted_by_errors {
if def_id.is_local()
&& tcx.has_typeck_tables(def_id)
&& tcx.typeck_tables_of(def_id).tainted_by_errors
{
return Err(ErrorHandled::Reported);
}

Expand Down
15 changes: 15 additions & 0 deletions src/test/ui/consts/issue-68684.rs
@@ -0,0 +1,15 @@
// check-pass

enum _Enum {
A(),
}

type _E = _Enum;

const fn _a() -> _Enum {
_E::A()
}

const _A: _Enum = _a();

fn main() {}

0 comments on commit be92200

Please sign in to comment.