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

is a scrutinee always a place expression? #1164

Open
steveklabnik opened this issue Feb 10, 2022 · 2 comments
Open

is a scrutinee always a place expression? #1164

steveklabnik opened this issue Feb 10, 2022 · 2 comments
Labels
Language Cleanup Improvements to existing language which is correct but not clear, or missing examples, or the like.

Comments

@steveklabnik
Copy link
Member

steveklabnik commented Feb 10, 2022

https://doc.rust-lang.org/stable/reference/expressions/match-expr.html says:

A match behaves differently depending on whether or not the scrutinee expression is a place expression or value expression.

And a little lower,

When the scrutinee expression is a place expression,

Let's click that link. It says:

The following contexts are place expression contexts:

...

The former implies it can be either, the latter implies it is always a place expression. I suspect that the wording of the latter is the one that's wrong.

@ehuss
Copy link
Collaborator

ehuss commented Feb 10, 2022

IIRC, the distinction here is that the scrutinee is a place expression context. A place context can receive either a place or value expression. Being a place expression context doesn't mean it can only take a place expression.

@steveklabnik
Copy link
Member Author

Ahhhh. That would make sense. I'm not sure if that means "close this bug, steve is just wrong" or if there's a way to make this distinction more obvious.

Regardless, thank you 👍

@ehuss ehuss added the Language Cleanup Improvements to existing language which is correct but not clear, or missing examples, or the like. label Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Language Cleanup Improvements to existing language which is correct but not clear, or missing examples, or the like.
Projects
None yet
Development

No branches or pull requests

2 participants