-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Document diverging functions, and ⊥, better #7538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Nominating for milestone 1, well-defined. It's not that we don't know what the semantics are here, just that it would be good to explain them better. |
@thestinger asked whether we couldn't just get rid of ! and use an uninhabited enum type instead. Off the top of my head I can't think of why not. (For example, |
@catamorphism It was explained to me on IRC a while ago when I asked why one couldn't use a polymorphic return type (instead of a void type I suggested forall a, a but that's basically the same idea) that ! is needed because the compiler needs extra information for borrowing purposes. I believe it was @brson who explained this to me but I don't quite remember. |
@sstewartgallus For borrowing, an uninhabited type would carry the exact same amount of information that ! does, AFAIK. Since it's impossible to construct a result of that type, declaring "I return |
Accepted for production-ready |
P-low, not 1.0 blocker |
#22275 documents these in the book, and we have info in the reference. |
Check expr usage for `manual_flatten` Fixes rust-lang#6784 Fixes rust-lang#7538 `manual_flatten` should not trigger when `if let` match expression will be used. changelog: [`manual_flatten`] checks for expr usage after `if let`
As per discussion on IRC, it's surprising at first that
return();
is an expression. What's the result type of this expression? Bottom / | , but since you can't write this type explicitly in Rust, it's confusing.Likewise, it's tempting to invoke
fn f() -> !
when trying to explain ⊥, but that's different -- it means "f definitely diverges".So, document these clearly and precisely in the manual / tutorial.
The text was updated successfully, but these errors were encountered: