Re:Weird Expressions in Rust
by derriz on Friday June 27, 2025 @03:30PM
(#44399565)
See my comment above, your example only "just works" if the enclosing function has the appropriate return type (in this case none).
So the syntactic element "return" is not just an expression - unlike other sub-expressions, it involves action at a distance - i.e. it must not just agree with it's context as part of an expression but it must agree with the enclosing fn signature.
So the syntactic element "return" is not just an expression - unlike other sub-expressions, it involves action at a distance - i.e. it must not just agree with it's context as part of an expression but it must agree with the enclosing fn signature.