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
I am confused by the following, and I wanted to see if it is a bug or not. The following successfully compiles:
pubfnf() -> ! {loop{}();}
The following without the semicolon does not:
pubfnf() -> ! {loop{}()// ERROR: expected ! found unit type}
I expected to see this happen:
My understanding is that the type of a block expression without a final expression is (), so I would expect these to both be the same — probably both should error, since I would expect both have the type () as the final expression. If not, can someone explain how the types resolve here?
Note: This was changed in #45880 (I think) where before that both were accepted.
I am confused by the following, and I wanted to see if it is a bug or not. The following successfully compiles:
The following without the semicolon does not:
I expected to see this happen:
My understanding is that the type of a block expression without a final expression is
()
, so I would expect these to both be the same — probably both should error, since I would expect both have the type()
as the final expression. If not, can someone explain how the types resolve here?Note: This was changed in #45880 (I think) where before that both were accepted.
Meta
rustc 1.54.0-nightly (ff2c947 2021-05-25)
The text was updated successfully, but these errors were encountered: