@@ -88,10 +88,21 @@ decl_derive!(
8888 /// that may be of interest to folders (thus preventing fields from being left unchanged
8989 /// erroneously).
9090 ///
91+ /// By default, `TypeFoldable` cannot be derived on types that contain nothing that may be of
92+ /// interest to folders as such an implementation is wholly superfluous and probably in error.
93+ /// However, on occasion it may nevertheless be necessary to implement `TypeFoldable` for such
94+ /// types even though any such fold will always be a noop (e.g. so that instances can be used
95+ /// in a generic context that is constrained to implementors of the trait); in such situations
96+ /// one can add a `#[skip_traversal(but_impl_despite_boring_because = "<reason>"]` attribute.
97+ ///
9198 /// In some rare situations, it may be desirable to skip folding of an item or field (or
92- /// variant) that might otherwise be of interest to folders: **this is dangerous and could lead
93- /// to miscompilation if user expectations are not met!** Nevertheless, such can be achieved
94- /// via a `#[skip_traversal(despite_potential_miscompilation_because = "<reason>"]` attribute.
99+ /// variant) that might otherwise be of interest to folders. This can be achieved via a
100+ /// `#[skip_traversal(despite_potential_miscompilation_because = "<reason>"]` attribute.
101+ /// Whereas the preceding usages of the `#[skip_traversal]` attribute are guaranteed to be
102+ /// sound by constraining the relevant type to implementors of the `BoringTraversable`
103+ /// trait, use of `despite_potential_miscompilation_because` does not add such constraint or
104+ /// provide any such guarantee. **It is therefore dangerous and could lead to miscompilation
105+ /// if user expectations are not met!**
95106 ///
96107 /// The derived implementation will use `TyCtxt<'tcx>` as the interner iff the annotated type
97108 /// has a `'tcx` lifetime parameter; otherwise it will be generic over all interners. It
@@ -119,10 +130,21 @@ decl_derive!(
119130 /// fields do not contain anything that may be of interest to visitors (thus preventing fields
120131 /// from being so skipped erroneously).
121132 ///
133+ /// By default, `TypeVisitable` cannot be derived on types that contain nothing that may be of
134+ /// interest to visitors as such an implementation is wholly superfluous and probably in error.
135+ /// However, on occasion it may nevertheless be necessary to implement `TypeVisitable` for such
136+ /// types even though any such visit will always be a noop (e.g. so that instances can be used
137+ /// in a generic context that is constrained to implementors of the trait); in such situations
138+ /// one can add a `#[skip_traversal(but_impl_despite_boring_because = "<reason>"]` attribute.
139+ ///
122140 /// In some rare situations, it may be desirable to skip visiting of an item or field (or
123- /// variant) that might otherwise be of interest to visitors: **this is dangerous and could lead
124- /// to miscompilation if user expectations are not met!** Nevertheless, such can be achieved
125- /// via a `#[skip_traversal(despite_potential_miscompilation_because = "<reason>"]` attribute.
141+ /// variant) that might otherwise be of interest to visitors. This can be achieved via a
142+ /// `#[skip_traversal(despite_potential_miscompilation_because = "<reason>"]` attribute.
143+ /// Whereas the preceding usages of the `#[skip_traversal]` attribute are guaranteed to be
144+ /// sound by constraining the relevant type to implementors of the `BoringTraversable`
145+ /// trait, use of `despite_potential_miscompilation_because` does not add such constraint or
146+ /// provide any such guarantee. **It is therefore dangerous and could lead to miscompilation
147+ /// if user expectations are not met!**
126148 ///
127149 /// The derived implementation will use `TyCtxt<'tcx>` as the interner iff the annotated type
128150 /// has a `'tcx` lifetime parameter; otherwise it will be generic over all interners. It
0 commit comments