You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Discriminant enum 'as f64' passes Sema then fails MIR validation ('unsupported cast in MIR'); spec names only integer targets #1502
A discriminant enum cast to a float type passes the checker and then fails the typed MIR validator: error: invalid MIR before codegen: unsupported cast in MIR. Either the checker rejects the cast with a user diagnostic, or it lowers; an internal MIR error on a program the checker accepted is neither.
enum Kind: u8:
Red = 1
Hi = 200
fn main:
let f = Kind.Hi as f64
print(f)
error: invalid MIR before codegen: unsupported cast in MIR
--> cast_f64.w:6:13
Spec
§4.4a: "Casting:value as i32 extracts the underlying integer (identity cast)." The spec names integer targets only; it does not say whether a float target is allowed (as the repr integer converted, 200.0) or rejected.
Activity
Codegen: a discriminant enum with an unsigned repr widens unsigned in…
Codegen: a discriminant enum with an unsigned repr widens unsigned in…
Codegen: a discriminant enum with an unsigned repr widens unsigned in…
MIR: `enum as number` is the discriminant read, because codegen has n…
MIR: `enum as number` is the discriminant read, because codegen has n…
MIR: `enum as number` is the discriminant read, because codegen has n…
Enums: payload discriminants, casts, generic layouts, and fn-type com…