-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Bad diagnostic for match ergonomics #51743
Comments
I strongly agree. On a more general note, I strongly think that the stabilization and feature gates mechanism should be reviewed. Haskell has GHC extensions and some of them (even though always used) have been there for quite a while now ( I would recommend to stop stabilizing features. To be more accurate:
That would enable people to use what they love (new features) by just adding the |
If the problem is with the error message, it seems that the thing to do is improve the error message, rather than disable the feature that causes it. |
The error message is entirely correct. the only issue is that the borrow checker runs after the type checker completed successfully. In this case, since the type checker failed, you did not get a borrowcheck error. If you add a deref to the place of the error, you should start getting the helpful errors. Additionally we should be pointing to the value that is matched. In order to get to borrowcheck errors in case of "trivial" typeck errors like missing derefs I wonder if we can treat such errors as if a deref occurred in order to continue execution, but additionally poison the location to make sure we don't report "move out of borrowed value" errors |
@varkor It seems that the bad error message is by design since the match ergonomics feature is enabled. |
@antoyo there is no match ergonomics feature that you can disable. And noone creates suboptimal error messages on purpose. This is a simple case of diagnostics that need improving. Your request most definitely needs an RFC, since it requires a major change (sub-language support) that has no precedent. |
That not what I meant and I'm sorry if it was interpreted that way. |
Indeed there are error message regressions. But my stance is that one should first unregress the errors and then think about whether bigger picture things are still necessary. Sorry about reading more into that statement than what was written. |
@oli-obk whole RFCs have been opened due to bad error messages: rust-lang/rfcs#2479 ... one of the alternatives mentioned in thread is to simply improve error messages and fail at a later point in time. |
Please let's get back for what I asked: option to disable match ergonomics. |
Adding a different feature switching mechanism definitely needs an RFC. Furthermore, this is a diagnostics issue first and foremost. Yes, there is an RFC opened for a diagnostic issue, which was when there seemed to be sufficient reason to actually support a pattern for familiarity. You can open an RFC for this too, but I'm pretty certain folks will want to try to fix this purely with diagnostics first 😄 |
(If you're really interested in making this happen I'd suggest a thread on https://internals.rust-lang.org/ to flesh out ideas first) |
This diagnostic issue is still present. Should we open an issue for it? Meanwhile, I'll reopen the issue with a different title (please close it when the other "clean" issue has been open). |
I don't think it's helpful for triage or in general if the issue text and discussion is still focused around the former. Anyone can open the diagnostics issue as a separate one if they wish. |
Opening a new issue with just saying "the diagnostic is bad" didn't seem very helpful to me considering that it might be very tricky to fix in here. So I was hoping someone with more insight knowledge might open another issue with some ideas in order to, if not starting a debate, propose an better diagnostic. Anyway, I'll open the issue with just "the diagnostic is bad" then to not lose track of it. |
Close it, thank you
…On 17 Mar 2020 1:01 a.m., "Manish Goregaokar" ***@***.***> wrote:
Closed #51743 <#51743>.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#51743 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGJEPHDC2BKQHLZZHWJ3GDDRHZLOBANCNFSM4FGTWNNQ>
.
|
Hi.
Match ergonomics can create quite confusing errors.
For instance:
(playground)
gives the following error message:
This error message is not even helping the user to figure out what the problem is.
Here, it's like if value was of type
&mut T
instead ofT
.So, to avoid these issues, please add an option to disable the match ergonomics feature.
Thanks a lot.
The text was updated successfully, but these errors were encountered: