Cool stuff, what's the significance of "!" as a return value? Haven't seen that one before.
fn usage() -> ! {
println!("usage: myapp FILENAME");
process::exit(0)
}
let filename = if args.len() < 2 {
args[1].clone()
} else {
usage()
};Up until now it's been a big edge case. This makes it considerably smaller.
[0] http://os.phil-opp.com/better-exception-messages.html#intrin...
This is of course a conservative analysis so e.g. "while true { }" is assumed to terminate and is rejected.
Failing to perform this verification correctly would trivially lead to memory unsafety as calling code is allowed to assume such a function returns any and all requested types.
Interesting, I think Haskell does sort of have a value for it, undefined. It's just that if you look at that value too hard, it throws. :)
(in case you were wondering who else does this)