@@ -88,10 +88,21 @@ decl_derive!(
88
88
/// that may be of interest to folders (thus preventing fields from being left unchanged
89
89
/// erroneously).
90
90
///
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
+ ///
91
98
/// 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!**
95
106
///
96
107
/// The derived implementation will use `TyCtxt<'tcx>` as the interner iff the annotated type
97
108
/// has a `'tcx` lifetime parameter; otherwise it will be generic over all interners. It
@@ -119,10 +130,21 @@ decl_derive!(
119
130
/// fields do not contain anything that may be of interest to visitors (thus preventing fields
120
131
/// from being so skipped erroneously).
121
132
///
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
+ ///
122
140
/// 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!**
126
148
///
127
149
/// The derived implementation will use `TyCtxt<'tcx>` as the interner iff the annotated type
128
150
/// has a `'tcx` lifetime parameter; otherwise it will be generic over all interners. It
0 commit comments