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
Moreover, using noreturn in an error union should be illegal.
e!noreturn has real uses (f.e. here), it means the function can either return an error value from e, or never return to the caller.
Constructing an error union value by (compatible) error value always works, and doesn't interact with the payload type in any way.
The only illegal behaviour in this code seems to me that the function returns not an error, but trying to instantiate the type noreturn. (That said, quite likely that !noreturn is majorly broken in the compiler though.)
Moreover, using noreturn in an error union should be illegal.
e!noreturn has real uses (f.e. here), it means the function can either return an error value from e, or never return to the caller.
Constructing an error union value by (compatible) error value always works, and doesn't interact with the payload type in any way.
The only illegal behaviour in this code seems to me that the function returns not an error, but trying to instantiate the type noreturn. (That said, quite likely that !noreturn is majorly broken in the compiler though.)
IMO !noreturn should be disallowed. If a function does not return under normal conditions, the abnormal conditions should be clear.
The following code caused the compiler to send a SIGKILL to itself on my computer, and crashed the compiler on godbolt.org:
Of course, the above program is ill-formed, yet the compiler accepts it.
Moreover, using
noreturn
in an error union with an inferred error set should be illegal.The text was updated successfully, but these errors were encountered: