Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete documentation of while let syntax regarding lazy boolean operator expressions. #771

Open
steffahn opened this issue Mar 3, 2020 · 4 comments
Labels
A-grammar Area: Syntax and parsing

Comments

@steffahn
Copy link
Member

steffahn commented Mar 3, 2020

Comparing the reference’s section on if let vs. the one on while let, the latter contains no note about top-level || and && being disallowed, even though this is the case by the corresponding RFC as well as in practice.

@Centril
Copy link
Contributor

Centril commented Mar 3, 2020

The corresponding RFC has not been stabilized, the syntax if p && let p = q { ... } is unstable. The reference only documents stable Rust.

@Centril Centril closed this as completed Mar 3, 2020
@steffahn
Copy link
Member Author

steffahn commented Mar 4, 2020

@Centril No. I’m talking about the part of the RFC that makes Rust2018 disallow certain expressions. This rule, that || and && cant appear inside if let or while let is part of stable Rust. It is even in the reference already, however only for if let, not for while let.

@Centril
Copy link
Contributor

Centril commented Mar 4, 2020

Oh you mean the Expression except struct or lazy boolean operator expression bit in if-let vs. while-let; yeah that needs to be updated. Want to send in a PR?

@Centril Centril reopened this Mar 4, 2020
@steffahn
Copy link
Member Author

steffahn commented Mar 4, 2020

Sure, I’ll do that. Playing around with this, there seems to be more to it though.. is seems as if the = changes precedence inside an if let. According to the reference it is supposed to be binding weaker than && and || and there’s also .. and ..= in between. Apparently the implementation of this part of the RFC changed things in a way that also disallows ..: see this playground.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-grammar Area: Syntax and parsing
Projects
None yet
Development

No branches or pull requests

3 participants