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 }}
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.
Just wanna prefix my comment by saying I'm really interested to see the never type land. Apologies if the comment isn't helpful.
IIUC from reading the comments from the previous threads, the issue is that if you write some code like
let v = ();
mem::transmute(v);
or something similar then the previous inference of mem::transmute<(), ()> changes to mem::transmute<(), !>, which means an optimizer assume the function is never called and potentially deletes the code and anything else that depends on it.
Would it be possible to just error when choosing between () and ! changes (or could change) the soundness of the code. The message could say "type inference could choose () or ! here, but picking ! incorrectly could lead to undefined behavior. Please provide explicit types".
EDIT: Or maybe it's not possible in general to say whether changing ! to () affects soundness, I'm not enough of a PL expert to say. As a programmer/user of rustc, I would not mind at all if my code stopped compiling across an epoch with a message saying "please annotate some more types".
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Purpose
Defining and stabilizing the
!
type, or ways to represent "impossible values".The text was updated successfully, but these errors were encountered: