google / google/zerocopy

[unsafe-fields] Support tuple structs

Open
#1,956 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2.6k
Forks
179
Avg merge
1d 19h
Merged PRs (30d)
29

Description

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:

```rust
struct Foo(Bar, Baz, Blah);
```

We would desugar into:

```rust
struct Foo(
Unsafe,
Unsafe,
Unsafe,
);
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.