-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Erroneously returning E0404 instead of E0245 #36337
Comments
Hmm, is it actually possible to generate E0245‽ It is generated in typeck, but E0404 is generated in resolve, which seems like an impenetrable barrier. |
So here is my take on the situation:
|
@TimNN we should probably remove E0245 then, or replace the code that currently generates it with an ICE and correctly decide between E0245/E0404 in resolve. E0404 is also generated for e.g. |
@durka Yes, I agree. I think we basically have two separate issues:
I'm not sure whether E0245 should be reused for the second case or rather whether a new error code should be introduced. |
It seems that if E0245 is actually an unrelated error, it might make sense to create a new error code. |
By the way, anyone know if it is also impossible to get E0103 and E0104? |
Was there ever any consensus on this? I completely forgot about this thread. |
@Mark-Simulacrum should I close this? I have no idea if this is still even an up-to-date issue... #32777 was already closed. |
I think this is fine to keep open at least for now. |
A note should be added for this case explaining that only traits can be trait bounds and if you want to use a struct in a method definition, it should be used directly where the type argument appears. |
@estebank I'm still a bit lost. What should happen to both error codes? Should any new error codes be added? I'm glad to try to implement this, but I'm not sure what needs to be done. |
245 should be removed if there's no way to reach it. Either adding a new more specific error code or modifying the error code description would be fine, leaning towards the first. |
Thanks @estebank ! I will look into it. |
Made a PR, but it is failing tests, and I don't understand why. Help would appreciated :) |
Remove E0245; improve E0404 Fix rust-lang#36337 Somehow this is currently breaking --explain, but I don't understand how. r? @estebank
I was working on #32777 and trying to generate E0245. I came up with the following example:
I believe this should return E0245, as
Foo
is not a trait, so it cannot be used as a bound. However, the compiler gives error E404, which states thatFoo
is not a trait, so it cannot be implemented for a type (according to https://doc.rust-lang.org/error-index.html#E0404).The text was updated successfully, but these errors were encountered: