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
In HEAD, I get a different error, but it's still wrong:
./src/test/run-pass/issue-1516.rs:1:47: 1:60 error: mismatched types: expected `fn@(str) -> !` but found `fn@(_|_) -> _|_` (return-by-value function found where non-returning function was expected)
./src/test/run-pass/issue-1516.rs:1 fn main() { let early_error: fn@(str) -> ! = {|msg| fail }; }
I disagree with my past self about whether this should compile. Right now, in the AST, there's only one way to introduce a diverging function: by writing a ! in place of its return type. Return styles are never inferred. Making closure potentially-diverging would require significant changes. It's possible, but it would add more outside-of-the-type-system baggage, if you know what I mean.
I'm going to close this, but @brson or anyone else, please file an RFC if you feel strongly about it :-)
This looks inferrable.
The text was updated successfully, but these errors were encountered: