Skip to content

Commit db48e95

Browse files
committed
Add discussion about fields in traits
1 parent cdafbed commit db48e95

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

text/0000-offset_of.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,3 +574,13 @@ features (like custom DSTs, extern types, or whatever other new unsized types we
574574
might want to add).
575575

576576
As such, it's left for future work.
577+
578+
## Fields in Traits
579+
580+
If support for fields in traits is ever added, then it would be an open question
581+
how `offset_of!` behaves when applied to a generic value of a trait type which
582+
has fields. Similarly, if an `offset_of_val!` is added, it would interact with
583+
trait objects of traits that have fields.
584+
585+
In either case, this could be forbidden or allowed, but decisions along these
586+
lines are deferred for now, as fields in traits do not yet exist.

0 commit comments

Comments
 (0)