Closed quantheory closed 9 years ago
Fixed by #28686
Now errors with
<anon>:4:16: 4:26 error: constant evaluation error: unresolved path in constant expression [E0080]
<anon>:4 ApplePie = Apple::PIE,
^~~~~~~~~~
Yay!
Modified from an example that @ahwatts provided in issue #22933:
Output with a recent nightly:
The original example gets an error through a different code path (
check_casts
->middle::CastTy::from_ty
->ty::type_is_c_like_enum
), but the result is still thatty::enum_variants
is called, which then attempts to evaluate the constant expression, causing an error.For unresolved paths I think we should have the
const_eval
functions return an error rather than panicking. This is a bit of a mess (e.g. lots of unhelpful uses ofOption
rather thanError
for error handling), and should be fixed anyway.