rust/src/libstd/io
bors 421a2113a8 Auto merge of #45039 - QuietMisdreavus:doc-spotlight, r=GuillaumeGomez,QuietMisdreavus
show in docs whether the return type of a function impls Iterator/Read/Write

Closes #25928

This PR makes it so that when rustdoc documents a function, it checks the return type to see whether it implements a handful of specific traits. If so, it will print the impl and any associated types. Rather than doing this via a whitelist within rustdoc, i chose to do this by a new `#[doc]` attribute parameter, so things like `Future` could tap into this if desired.

### Known shortcomings

~~The printing of impls currently uses the `where` class over the whole thing to shrink the font size relative to the function definition itself. Naturally, when the impl has a where clause of its own, it gets shrunken even further:~~ (This is no longer a problem because the design changed and rendered this concern moot.)

The lookup currently just looks at the top-level type, not looking inside things like Result or Option, which renders the spotlights on Read/Write a little less useful:

<details><summary>`File::{open, create}` don't have spotlight info (pic of old design)</summary>

![image](https://user-images.githubusercontent.com/5217170/31209495-e59d027e-a950-11e7-9998-ceefceb71c07.png)

</details>

All three of the initially spotlighted traits are generically implemented on `&mut` references. Rustdoc currently treats a `&mut T` reference-to-a-generic as an impl on the reference primitive itself. `&mut Self` counts as a generic in the eyes of rustdoc. All this combines to create this lovely scene on `Iterator::by_ref`:

<details><summary>`Iterator::by_ref` spotlights Iterator, Read, and Write (pic of old design)</summary>

![image](https://user-images.githubusercontent.com/5217170/31209554-50b271ca-a951-11e7-928b-4f83416c8681.png)

</details>
2017-11-21 03:03:28 +00:00
..
buffered.rs Implement is_empty() for BufReader 2017-10-18 14:27:33 -04:00
cursor.rs Fix typo in doc 2017-08-17 00:46:30 +02:00
error.rs use field init shorthand EVERYWHERE 2017-08-15 15:29:17 -07:00
impls.rs Add read_to_end implementation to &[u8]'s Read impl 2017-10-07 22:19:51 +02:00
lazy.rs use field init shorthand EVERYWHERE 2017-08-15 15:29:17 -07:00
mod.rs Auto merge of #45039 - QuietMisdreavus:doc-spotlight, r=GuillaumeGomez,QuietMisdreavus 2017-11-21 03:03:28 +00:00
prelude.rs std: Remove deprecated functionality from 1.5 2015-12-10 11:47:55 -08:00
stdio.rs std: Change how EBADF is handled in sys 2017-11-08 20:41:17 -08:00
util.rs Rollup merge of #44712 - oconnor663:copy_test, r=GuillaumeGomez 2017-09-23 00:29:13 -04:00