Ok so can anyone explain to me why anyone should care about the semantics of `match never { x => { ... } }`? Isn't the match dead code?
-
-
Replying to @Gankro
It's the semantics of `match never { }` you have to care about.
1 reply 0 retweets 0 likes -
-
Replying to @Gankro
Read the RFC. It's about semantics of matching w/ trap values and how it relates to UB for all types.
1 reply 0 retweets 0 likes -
-
Replying to @Gankro
TL;DR: match (!,) {} should compile and evaluating it should be UB making it the same as match ! {}
2 replies 0 retweets 0 likes -
Main goal of static typing is to avoid UB. A construct guaranteed statically to result in UB should be rejected statically.
1 reply 0 retweets 1 like -
Replying to @BRIAN_____ @Gankro
Unsafe code can violate the type system however it pleases.
1 reply 0 retweets 0 likes -
1. This example isn't about any unsafe code, 2. `unsafe` is irrelevant as far as this guideline goes.
1 reply 0 retweets 0 likes -
Replying to @BRIAN_____ @sgrif
insight from other subthread: some people have used Never* to repr C's void*, and then &Never to try to get more safety.
2 replies 0 retweets 0 likes
Yes, that was me! See https://github.com/briansmith/ring/issues/416 … and https://github.com/rust-lang/rfcs/pull/1861 … and https://github.com/rust-lang/rfcs/pull/1783 ….
-
-
Replying to @BRIAN_____ @sgrif
a) doh! Late stressed out night! b) omg your ring PR is so cool ~swoon~
0 replies 0 retweets 1 likeThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.