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

Missing help on pattern guard #33247

Closed
GuillaumeGomez opened this issue Apr 27, 2016 · 7 comments
Closed

Missing help on pattern guard #33247

GuillaumeGomez opened this issue Apr 27, 2016 · 7 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@GuillaumeGomez
Copy link
Member

One the following code, suggesting to use ref keyword would be very appreciated I think.

@GuillaumeGomez GuillaumeGomez changed the title Missing help on pattern-guard Missing help on pattern guard Apr 27, 2016
@durka
Copy link
Contributor

durka commented Apr 28, 2016

Hmm, need to be careful though... if the pattern guard actually consumes the value then you'll get a bug report for the compiler recommending wrong code: http://is.gd/zGSj9C

@GuillaumeGomez
Copy link
Member Author

Hum... Then maybe an update of the error code explanation would be more appropriate to show the differences between the two cases.

@mrmiywj
Copy link
Contributor

mrmiywj commented Apr 28, 2016

Hmm, using ref keyword is helpful here.
But in this example, what will be helpful except use &self in consume?

@GuillaumeGomez
Copy link
Member Author

@mrmiywj: That's the point that durka pointed out. So that's why I propose to only change error explanation to reflect both cases.

@mrmiywj
Copy link
Contributor

mrmiywj commented Apr 28, 2016

You mean that if in the context the ownership will not be taken, it is suggested to use ref here?
Hmm, if it's right, I think it's a easy job and I can change the explanation to reflect both cases with some examples. U should not waste time on this dirty job.

@GuillaumeGomez
Copy link
Member Author

GuillaumeGomez commented Apr 28, 2016

Haha! Please do it if you want. cc me on the PR so I can review it (and don't forget to say "Fixes #33247").

@steveklabnik steveklabnik added the A-diagnostics Area: Messages for errors, warnings, and lints label Jul 25, 2016
@nikomatsakis
Copy link
Contributor

Fixed by #33260

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

No branches or pull requests

5 participants