@@ -90,10 +90,21 @@ decl_derive!(
90
90
/// only be applicable if `T` does not contain anything that may be of interest to folders
91
91
/// (thus preventing fields from being so-skipped erroneously).
92
92
///
93
+ /// By default, `TypeFoldable` cannot be derived on types that contain nothing that may be of
94
+ /// interest to folders as such an implementation is wholly superfluous and probably in error.
95
+ /// However, on occasion it may nevertheless be necessary to implement `TypeFoldable` for such
96
+ /// types even though any such fold will always be a noop (e.g. so that instances can be used
97
+ /// in a generic context that is constrained to implementors of the trait); in such situations
98
+ /// one can add a `#[skip_traversal(but_impl_despite_trivial_because = "<reason>"]` attribute.
99
+ ///
93
100
/// In some rare situations, it may be desirable to skip folding of an item or field (or
94
- /// variant) that might otherwise be of interest to folders: **this is dangerous and could lead
95
- /// to miscompilation if user expectations are not met!** Nevertheless, such can be achieved
96
- /// via a `#[skip_traversal(despite_potential_miscompilation_because = "<reason>"]` attribute.
101
+ /// variant) that might otherwise be of interest to folders. This can be achieved via a
102
+ /// `#[skip_traversal(despite_potential_miscompilation_because = "<reason>"]` attribute.
103
+ /// Whereas the preceding usages of the `#[skip_traversal]` attribute are guaranteed to be
104
+ /// sound by constraining the interner to implementors of the `TriviallyTraverses<T>` trait,
105
+ /// use of `despite_potential_miscompilation_because` does not add such constraint or provide
106
+ /// any such guarantee. **It is therefore dangerous and could lead to miscompilation if user
107
+ /// expectations are not met!**
97
108
///
98
109
/// The derived implementation will use `TyCtxt<'tcx>` as the interner iff the annotated type
99
110
/// has a `'tcx` lifetime parameter; otherwise it will be generic over all interners. It
@@ -124,10 +135,21 @@ decl_derive!(
124
135
/// only be applicable if `T` does not contain anything that may be of interest to visitors
125
136
/// (thus preventing fields from being so-skipped erroneously).
126
137
///
138
+ /// By default, `TypeVisitable` cannot be derived on types that contain nothing that may be of
139
+ /// interest to visitors as such an implementation is wholly superfluous and probably in error.
140
+ /// However, on occasion it may nevertheless be necessary to implement `TypeVisitable` for such
141
+ /// types even though any such visit will always be a noop (e.g. so that instances can be used
142
+ /// in a generic context that is constrained to implementors of the trait); in such situations
143
+ /// one can add a `#[skip_traversal(but_impl_despite_trivial_because = "<reason>"]` attribute.
144
+ ///
127
145
/// In some rare situations, it may be desirable to skip visiting of an item or field (or
128
- /// variant) that might otherwise be of interest to visitors: **this is dangerous and could lead
129
- /// to miscompilation if user expectations are not met!** Nevertheless, such can be achieved
130
- /// via a `#[skip_traversal(despite_potential_miscompilation_because = "<reason>"]` attribute.
146
+ /// variant) that might otherwise be of interest to visitors. This can be achieved via a
147
+ /// `#[skip_traversal(despite_potential_miscompilation_because = "<reason>"]` attribute.
148
+ /// Whereas the preceding usages of the `#[skip_traversal]` attribute are guaranteed to be
149
+ /// sound by constraining the interner to implementors of the `TriviallyTraverses<T>` trait,
150
+ /// use of `despite_potential_miscompilation_because` does not add such constraint or provide
151
+ /// any such guarantee. **It is therefore dangerous and could lead to miscompilation if user
152
+ /// expectations are not met!**
131
153
///
132
154
/// The derived implementation will use `TyCtxt<'tcx>` as the interner iff the annotated type
133
155
/// has a `'tcx` lifetime parameter; otherwise it will be generic over all interners. It
0 commit comments