-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
std.AutoHashMap allows string keys #7330
Comments
cc @Sahnvour |
Seems like a bug indeed. |
Is |
I think it's pretty safe to assume they don't have padding in practice, but afaik there is no guarantee about it. |
Slices currently do not have well defined memory layout. |
Hi! I'm interested in taking this issue. However, I'm not sure if it makes sense to emit |
There is no way to generate a warning, but I think a compile error is the right thing here. |
Ah gotcha, so this issue is actually more that |
Sounds great! Keep in mind that this also applies to struct keys that contain slice fields. |
@SpexGuy I tried to change |
That looks wrong, I think you might be hitting #7532. |
@Vexu my bad, it appears that I forgot to mark expressions as |
I think this is a bug, feel free to close if this is intentional. The
autoHash
function contains this check, which seems like it is meant to disallow string keys in AutoHashMap:However, before running this code, it does this check:
trait.hasUniqueRepresentation(..)
hits this case for slices:So
autoHash
never gets compiled for the case where the key is a string, and the compile error does not trigger.The text was updated successfully, but these errors were encountered: