Skip to content
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

[unsafe-fields] Support tuple structs #1956

Open
joshlf opened this issue Oct 21, 2024 · 0 comments
Open

[unsafe-fields] Support tuple structs #1956

joshlf opened this issue Oct 21, 2024 · 0 comments

Comments

@joshlf
Copy link
Member

joshlf commented Oct 21, 2024

While generating field names in macros would be tricky (since we'd need to synthesize 0, 1, etc), we don't actually need to use field names - we just need to use unique strings. We can do this by having the string input to the hash function be all types up through and including the given field. E.g., for the type:

struct Foo(Bar, Baz, Blah);

We would desugar into:

struct Foo(
    Unsafe<Foo, Bar, {hash_field_name("Bar")}>,
    Unsafe<Foo, Bar, {hash_field_name("BarBaz")}>,
    Unsafe<Foo, Bar, {hash_field_name("BarBazBlah")}>,
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant