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 don't think this has anything to do with being unsafe in particular. Any block-style expression in the last expression statement of a block cannot have braces (particularly as the first expression of a compound expression). For example, {{1}==0} doesn't parse. Some more details are at rust-lang/reference#569.
I don't know if this is particularly intended, or if it is fixable. There is ambiguity in some circumstances (like if condition expressions), but it doesn't seem like there is any particular ambiguity as the tail of a block.
I tried this code (playground):
I expected to see this happen: The result of
foo()
would return from theunsafe
block and be compared to0
.Instead, this happened: Compilation failed because the parser wanted type
()
instead of the expectedusize
for comparison to0
.Incidentally, compilation is successful if the
unsafe
block is instead on the right-hand side:Meta
rustc --version --verbose
:(the behavior is identical with
1.46.0-beta.2
and1.47.0-nightly
compilers)The text was updated successfully, but these errors were encountered: