@@ -211,36 +211,6 @@ pub struct BigX;
211
211
Then, when looking for it through the ` rustdoc ` search, if you enter "x" or
212
212
"big", search will show the ` BigX ` struct first.
213
213
214
- ### Include items only when collecting doctests
215
-
216
- Rustdoc's [ documentation tests] can do some things that regular unit tests can't, so it can
217
- sometimes be useful to extend your doctests with samples that wouldn't otherwise need to be in
218
- documentation. To this end, Rustdoc allows you to have certain items only appear when it's
219
- collecting doctests, so you can utilize doctest functionality without forcing the test to appear in
220
- docs, or to find an arbitrary private item to include it on.
221
-
222
- If you add ` #![feature(cfg_doctest)] ` to your crate, Rustdoc will set ` cfg(doctest) ` when collecting
223
- doctests. Note that they will still link against only the public items of your crate; if you need to
224
- test private items, unit tests are still the way to go.
225
-
226
- In this example, we're adding doctests that we know won't compile, to verify that our struct can
227
- only take in valid data:
228
-
229
- ``` rust
230
- #![feature(cfg_doctest)]
231
-
232
- /// We have a struct here. Remember it doesn't accept negative numbers!
233
- pub struct MyStruct (usize );
234
-
235
- /// ```compile_fail
236
- /// let x = my_crate::MyStruct(-5);
237
- /// ```
238
- #[cfg(doctest)]
239
- pub struct MyStructOnlyTakesUsize ;
240
- ```
241
-
242
- [ documentation tests ] : documentation-tests.html
243
-
244
214
## Unstable command-line arguments
245
215
246
216
These features are enabled by passing a command-line flag to Rustdoc, but the flags in question are
0 commit comments