-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
non-scalar cast: error message is unclear #31174
Comments
The type of |
You may have meant to do: let offset = codepoint as u32 - offsets[offsetPos] as u32; |
Not a bug in rustc. Error looks quite clear to me. Closing. |
Huh, now that it's been pointed out as confusing, I agree: I wouldn't call an error message that just says "non-scalar cast" clear. It's quite jargon-y, and could easily be improved with a
Minimal example: fn foo<T>(x: T) -> u32 {
x as u32
}
fn main() {} |
T
as u32
Of course, using the |
Also, casts are quite often used for type ascription - at least until |
I don't think we need to make sure the error message precisely covers every case: it is certainly reasonable for some
|
I don't think that would have helped here. |
Sorry, I may have been confusing: I see that my original message only implied that the message should be changed to not be so jargon-y, it didn't actually say that removing/expanding the "non-scalar cast" part would be good in addition to adding more help to handle other cases. |
[I don't care either way] |
That's confusing so I can not do something with integer overrides. |
I'd also like to say that I'm getting a confusing error when I'm trying to cast
and I'm not sure if it's because of the Even just a |
It's because of the |
I get that now, but the error message could be less confusing, perhaps just saying "unable to cast between these types" instead of "non-scalar cast", which is some jargon I am not familiar with. |
By luck, it seems I fixed this issue. I'll link to the PR once opened. |
…des, r=QuietMisdreavus Create more error codes Fixes rust-lang#31174. Part of rust-lang#42229. cc @Susurrus
The text was updated successfully, but these errors were encountered: