File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -521,6 +521,22 @@ This RFC does not propose that solution because:
521
521
522
522
The authors are not aware of any macros using a ` #[pointee] ` attribute today.
523
523
524
+ ## Derive macro or not?
525
+
526
+ Stabilizing this as a derive macro more or less locks us in with the decision
527
+ that the compiler will use traits to specify which types are compatible with
528
+ trait objects. However, one could imagine other mechanisms. For example, stable
529
+ Rust currently has logic saying that any struct where the last field is ` ?Sized `
530
+ will work with unsizing operations. (E.g., if ` Wrapper ` is such a struct, then
531
+ you can convert from ` Box<Wrapper<[u8; 10]>> ` to ` Box<Wrapper<[u8]>> ` .) That
532
+ mechanism is not specified using a trait.
533
+
534
+ However, using traits for this functionality seems to be the most flexible. To
535
+ solve the unresolved questions, we most likely need to constrain the
536
+ implementations of these traits for ` Pin ` with stricter trait bounds than what
537
+ is specified on the struct. That will get much more complicated if we use a
538
+ mechanism other than traits to specify this logic.
539
+
524
540
# Prior art
525
541
[ prior-art ] : #prior-art
526
542
You can’t perform that action at this time.
0 commit comments