@@ -264,6 +264,8 @@ Point 1 and 2 are verified syntactically by the derive macro, whereas 3 and 4
264
264
are verified semantically by the compiler when checking the generated
265
265
[ ` DispatchFromDyn ` ] implementation as it does today.
266
266
267
+ The ` #[pointee] ` attribute may also be written as ` #[smart_pointer::pointee] ` .
268
+
267
269
## Expansion
268
270
269
271
The macro will expand to two implementations, one for
@@ -486,6 +488,30 @@ refcounted value with multiple lists. People have argued that it would be
486
488
better to change this to a generic type instead of a const generic, so it would
487
489
be useful to keep the option of having multiple generic types on the struct.
488
490
491
+ ### Conflicts with third-party derive macros
492
+
493
+ The ` #[pointee] ` attribute could in principle conflict with other derive macros
494
+ that also wish to annotate one of the parameters with an attribute called
495
+ ` #[pointee] ` . To disambiguate such cases, we also allow the attribute to be
496
+ spelled ` #[smart_pointer::pointee] ` .
497
+
498
+ It is an error to specify both ` #[pointee] ` and ` #[smart_pointer::pointee] ` , so
499
+ both macros must support this kind of disambiguation.
500
+
501
+ Another way to avoid conflicts between ` #[derive(SmartPointer)] ` and third-party
502
+ macros is to always assume that the first generic parameter is the pointee.
503
+ This RFC does not propose that solution because:
504
+
505
+ * It prevents the pointee from having a default unless it is the only parameter,
506
+ because parameters with a default must come last.
507
+ * If logic such as "the first parameter" becomes commonplace in macro design,
508
+ then it does not really solve the issue with conflicts: you could have two
509
+ macros that both assume that the first parameter is special. And this kind of
510
+ conflict will be more common than attribute conflicts, because the attribute
511
+ will only conflict if both macros use an attribute of the same name.
512
+
513
+ The authors are not aware of any macros using a ` #[pointee] ` attribute today.
514
+
489
515
# Prior art
490
516
[ prior-art ] : #prior-art
491
517
0 commit comments