mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 07:22:42 +00:00
Check has_typeck_tables
before calling typeck_tables_of
This commit is contained in:
parent
21ed50522d
commit
be92200af7
@ -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);
|
||||
}
|
||||
|
||||
|
15
src/test/ui/consts/issue-68684.rs
Normal file
15
src/test/ui/consts/issue-68684.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// check-pass
|
||||
|
||||
enum _Enum {
|
||||
A(),
|
||||
}
|
||||
|
||||
type _E = _Enum;
|
||||
|
||||
const fn _a() -> _Enum {
|
||||
_E::A()
|
||||
}
|
||||
|
||||
const _A: _Enum = _a();
|
||||
|
||||
fn main() {}
|
Loading…
Reference in New Issue
Block a user