Add discussion about fields in traits

This commit is contained in:
Thom Chiovoloni 2022-12-13 08:30:11 -08:00
parent cdafbed903
commit db48e95574
No known key found for this signature in database
GPG Key ID: D7733D1D7A775F0A
1 changed files with 10 additions and 0 deletions

View File

@ -574,3 +574,13 @@ features (like custom DSTs, extern types, or whatever other new unsized types we
might want to add).
As such, it's left for future work.
## Fields in Traits
If support for fields in traits is ever added, then it would be an open question
how `offset_of!` behaves when applied to a generic value of a trait type which
has fields. Similarly, if an `offset_of_val!` is added, it would interact with
trait objects of traits that have fields.
In either case, this could be forbidden or allowed, but decisions along these
lines are deferred for now, as fields in traits do not yet exist.