-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Cleanup check_cast. Fixes #21554 #21606
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
Conversation
This also makes the cast error messages somewhat more uniform.
(rust_highfive has picked a reviewer for you, use r? to override) |
@@ -3128,7 +3128,6 @@ pub fn type_is_scalar(ty: Ty) -> bool { | |||
ty_bool | ty_char | ty_int(_) | ty_float(_) | ty_uint(_) | | |||
ty_infer(IntVar(_)) | ty_infer(FloatVar(_)) | | |||
ty_bare_fn(..) | ty_ptr(_) => true, | |||
ty_tup(ref tys) if tys.is_empty() => true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is ()
not scalar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that this might have non-local consequence, beyond just changing these error messages slightly, maybe just changing the internals of the cast checking would be more reliable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit structs aren't scalars. Unit enums aren't scalars. ((),)
isn't a scalar. I checked the other places that use this function – they don't care.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, good; checking convinces me.
r? @huonw |
This also makes the cast error messages somewhat more uniform.
This also makes the cast error messages somewhat more uniform.