about summary refs log tree commit diff
path: root/src/librustdoc/html/render.rs
AgeCommit message (Collapse)AuthorLines
2016-11-20Rollup merge of #37881 - ollie27:rustdoc_stab_enum_macro, r=alexcrichtonGuillaume Gomez-2/+0
rustdoc: Remove unnecessary stability versions For some reason only on enum and macro pages, the stability version is rendered after the summary unlike all other pages. As it is already displayed at the top of the page for all items, this removes it for consistency and to prevent it from overlapping the summary text. Fixes #36093
2016-11-19rustdoc: Remove unnecessary stability versionsOliver Middleton-2/+0
For some reason only on enum and macro pages, the stability version is rendered after the summary unlike all other pages. As it is already displayed at the top of the page for all items, this removes it for consistency and to prevent it from overlapping the summary text.
2016-11-18Auto merge of #37763 - liigo:rustdoc-playground, r=alexcrichtonbors-4/+2
rustdoc: add cli argument `--playground-url` Add a new cli argument `--playground-url` for rustdoc: `rustdoc lib.rs --playground-url="https://play.rust-lang.org/"` `rustdoc book.md --playground-url="https://play.rust-lang.org/"` This makes it possible for tools like https://docs.rs to generate crate docs that can submit samples code to run at https://play.rust-lang.org, even if the crate's author *forgot* putting `#![doc(html_playground_url = "https://play.rust-lang.org/")]` to crate root. By the way, I'd like to say, many crate authors are not aware of existing of `#![doc(html_playground_url = "https://play.rust-lang.org/")]`. `--playground-url` may be reset by `--markdown-playground-url` or `#![doc(html_playground_url=...)]`, so it's backward compatible. @alexcrichton since you implemented playground-url related features.
2016-11-17doc: nits and typos on commentsTshepang Lekhonkhobe-17/+17
2016-11-16Auto merge of #37773 - ollie27:rustdoc_inline_glob, r=brsonbors-35/+17
rustdoc: Fix some local inlining issues * Only inline public items when inlining glob imports. * Never inline while in a private module or a child of a private module. * Never inline impls. This allowed the removal of a workaround in the rendering code.
2016-11-14rustdoc: Fix some local inlining issuesOliver Middleton-35/+17
* Only inline public items when inlining glob imports. * Never inline while in a private module or a child of a private module. * Never inline impls. This allowed the removal of a workaround in the rendering code.
2016-11-14rustdoc: add cli argument `--playground-url`Liigo-4/+2
2016-11-13do not use deprecated text for unstable docsAndy Russell-4/+9
2016-11-12Auto merge of #37728 - QuietMisdreavus:rustdoc-enum-struct, r=GuillaumeGomezbors-3/+8
rustdoc: fold fields for enum struct variants into a docblock Per discussion in #37500, this PR updates the enum rendering code to wrap variants with named struct fields in a `docblock` span that is hidden automatically upon load of the page. This gives struct variant fields a clean separation from other enum variants, giving a boost to the readability of such documentation. Preview output is available [on the issue page](https://github.com/rust-lang/rust/issues/37500#issuecomment-260069269), but for the sake of completeness I'll include the images here again. ![rustdoc struct enum variant 4 part 1](https://cloud.githubusercontent.com/assets/5217170/20231925/96160b7e-a82a-11e6-945b-bbba95c5e4bc.PNG) When you initially load the page, there's a line under variants with struct fields letting you know you can click to expand the listing. ![rustdoc struct enum variant 4 part 2](https://cloud.githubusercontent.com/assets/3050060/20232067/1dc63266-a866-11e6-9555-8fb1c8afdcec.png) If you click to expand, the header and table unfold into a nicely-indented listing. If you want to take a look in your own browser and screen size, [I've got this version hosted on my server](https://shiva.icesoldier.me/doctest/doctest/enum.OldTopicRemoval.html). Fixes #37500 r? @GuillaumeGomez
2016-11-12rustdoc: fold fields for enum struct variants into a docblockQuietMisdreavus-3/+8
2016-11-12Rollup merge of #37190 - QuietMisdreavus:rustdoc-where-newline, r=GuillaumeGomezEduard-Mihai Burtescu-27/+66
rustdoc: add line breaks to where clauses a la rustfmt Much like my last PR for rustdoc (#36679), this adds line breaks to certain statements based on their line length. Here the focus was on where clauses. Some examples: - [Where clause in a trait function](https://shiva.icesoldier.me/custom-std/std/iter/trait.Iterator.html?search=#method.unzip) (also in the trait header block at the top of the page) - [Where clause on a bare function](https://shiva.icesoldier.me/doc-custom2/petgraph/visit/fn.depth_first_search.html) - [Where clauses in trait impls on a struct](https://shiva.icesoldier.me/custom-std/std/collections/struct.HashMap.html) (scroll to the bottom) These are regularly not on their own line, but will be given their own line now if their "prefix text" doesn't give them enough room to sensibly print their constraints. HashMap's trait impls provide some examples of both behaviors. The libstd links above are the whole docs rendered with this, and the "bare function" link above is in another set that pulls some notable crates together. `petgraph` was the one that brought this request up, and that collection also includes [itertools](https://shiva.icesoldier.me/doc-custom2/itertools/trait.Itertools.html) which provided an easy sample to test with. r? @GuillaumeGomez
2016-11-09Rollup merge of #37250 - liigo:rustdoc-unsafe-fns, r=steveklabnikEduard-Mihai Burtescu-1/+10
rustdoc: mark unsafe fns in module page with superscript icons Note: I'v changed the mark style. Now use superscript ⚠(U+26A0) (the old one is '[Unsafe]' literal). Basically per https://botbot.me/mozilla/rust-docs/2016-10-19/?msg=75112017&page=1 ![unsafe-fn-icon](https://cloud.githubusercontent.com/assets/346530/19633650/7f6e1eea-99e6-11e6-8d09-31aec83e46a5.png) ![unsafe-fn](https://cloud.githubusercontent.com/assets/346530/19472050/39daded2-9558-11e6-9148-3cb12afd1c9a.png)
2016-11-09Rollup merge of #37229 - nnethercote:FxHasher, r=nikomatsakisEduard-Mihai Burtescu-28/+28
Replace FNV with a faster hash function. Hash table lookups are very hot in rustc profiles and the time taken within `FnvHash` itself is a big part of that. Although FNV is a simple hash, it processes its input one byte at a time. In contrast, Firefox has a homespun hash function that is also simple but works on multiple bytes at a time. So I tried it out and the results are compelling: ``` futures-rs-test 4.326s vs 4.212s --> 1.027x faster (variance: 1.001x, 1.007x) helloworld 0.233s vs 0.232s --> 1.004x faster (variance: 1.037x, 1.016x) html5ever-2016- 5.397s vs 5.210s --> 1.036x faster (variance: 1.009x, 1.006x) hyper.0.5.0 5.018s vs 4.905s --> 1.023x faster (variance: 1.007x, 1.006x) inflate-0.1.0 4.889s vs 4.872s --> 1.004x faster (variance: 1.012x, 1.007x) issue-32062-equ 0.347s vs 0.335s --> 1.035x faster (variance: 1.033x, 1.019x) issue-32278-big 1.717s vs 1.622s --> 1.059x faster (variance: 1.027x, 1.028x) jld-day15-parse 1.537s vs 1.459s --> 1.054x faster (variance: 1.005x, 1.003x) piston-image-0. 11.863s vs 11.482s --> 1.033x faster (variance: 1.060x, 1.002x) regex.0.1.30 2.517s vs 2.453s --> 1.026x faster (variance: 1.011x, 1.013x) rust-encoding-0 2.080s vs 2.047s --> 1.016x faster (variance: 1.005x, 1.005x) syntex-0.42.2 32.268s vs 31.275s --> 1.032x faster (variance: 1.014x, 1.022x) syntex-0.42.2-i 17.629s vs 16.559s --> 1.065x faster (variance: 1.013x, 1.021x) ``` (That's a stage1 compiler doing debug builds. Results for a stage2 compiler are similar.) The attached commit is not in a state suitable for landing because I changed the implementation of FnvHasher without changing its name (because that would have required touching many lines in the compiler). Nonetheless, it is a good place to start discussions. Profiles show very clearly that this new hash function is a lot faster to compute than FNV. The quality of the new hash function is less clear -- it seems to do better in some cases and worse in others (judging by the number of instructions executed in `Hash{Map,Set}::get`). CC @brson, @arthurprs
2016-11-08Replace FnvHasher use with FxHasher.Nicholas Nethercote-28/+28
This speeds up compilation by 3--6% across most of rustc-benchmarks.
2016-11-06Improve attributes display and allow expansionGuillaume Gomez-8/+9
2016-11-06Set possibility to hide attributesGuillaume Gomez-11/+15
2016-11-06Print more tags in rustdocGuillaume Gomez-8/+40
2016-10-31Changed most vec! invocations to use square bracesiirelu-1/+1
Most of the Rust community agrees that the vec! macro is clearer when called using square brackets [] instead of regular brackets (). Most of these ocurrences are from before macros allowed using different types of brackets. There is one left unchanged in a pretty-print test, as the pretty printer still wants it to have regular brackets.
2016-10-25rustdoc: mark unsafe fns with iconsLiigo Zhuang-1/+10
2016-10-17rustdoc: make Method/WhereClause wrappers use usize for indentsQuietMisdreavus-28/+19
2016-10-15rustdoc: Improve playground run buttonsOliver Middleton-6/+2
The main change is to stop using javascript to generate the URLs and use rustdoc instead. This also adds run buttons to the error index examples.
2016-10-15rustdoc: apply proper indent when where clauses aren't on their own lineQuietMisdreavus-22/+70
2016-10-11Rollup merge of #36679 - QuietMisdreavus:rustdoc-line-breaks, r=steveklabnikGuillaume Gomez-2/+17
rustdoc: print non-self arguments of bare functions and struct methods on their own line This change alters the formatting rustdoc uses when it creates function and struct method documentation. For bare functions, each argument is printed on its own line. For struct methods, non-self arguments are printed on their own line. In both cases, no line breaks are introduced if there are no arguments, and for struct methods, no line breaks are introduced if there is only a single self argument. This should aid readability of long function signatures and allow for greater comprehension of these functions. I've run rustdoc with these changes on my crate egg-mode and its set of dependencies and put the result [on my server](https://shiva.icesoldier.me/doc-custom/egg_mode/). Of note, here are a few shortcut links that highlight the changes: * [Bare function with a long signature](https://shiva.icesoldier.me/doc-custom/egg_mode/place/fn.reverse_geocode.html) * [Struct methods, with single self argument and with self and non-self arguments](https://shiva.icesoldier.me/doc-custom/egg_mode/tweet/struct.Timeline.html#method.reset) * [Bare functions with no arguments](https://shiva.icesoldier.me/doc-custom/rand/fn.thread_rng.html) and [struct methods with no arguments](https://shiva.icesoldier.me/doc-custom/hyper/client/struct.Client.html#method.new) are left unchanged. This PR consists of two commits: one for bare functions and one for struct methods.
2016-10-02Remove redundant 'Variant' in variant names, stop reexporting.Corey Farwell-6/+8
2016-10-02Cleanup `return` statements.Corey Farwell-5/+5
2016-09-30Simplify logic around Context's root_path.Corey Farwell-14/+12
Was previously cached and maintained in the `Context`, which to me seems overkill.
2016-09-30Migrate Item ➡ ItemType function to method.Corey Farwell-25/+20
2016-09-26rustdoc: format bare functions like rustfmtQuietMisdreavus-8/+8
see commit 2a274e72 for details
2016-09-26rustdoc: format struct methods like rustfmtQuietMisdreavus-1/+16
* ignore signatures 80 characters or shorter * otherwise, put arguments and return arrow on their own line, indented to the opening parenthesis in doing this, most of a plain-text output has been written for rustdoc, accessible through "alternate" Display printing: "{:#}"
2016-09-26refactor away get_unstable_features_settingTim Neumann-3/+2
2016-09-20rustc_metadata: go only through rustc_serialize in astencode.Eduard Burtescu-5/+4
2016-09-15Auto merge of #36393 - petrochenkov:ancient, r=eddybbors-1/+1
Remove some obsolete code from the compiler
2016-09-14Auto merge of #36293 - liigo:docblock-short, r=steveklabnikbors-1/+1
rustdoc: don't collapse `docblock-short` ![docblock-short](https://cloud.githubusercontent.com/assets/346530/18267298/137d2542-7451-11e6-9c8e-dd4e1f1fea29.png)
2016-09-14Auto merge of #36472 - GuillaumeGomez:rollup, r=GuillaumeGomezbors-1/+2
Rollup of 5 pull requests - Successful merges: #36334, #36335, #36363, #36374, #36467 - Failed merges:
2016-09-14Rollup merge of #36334 - GuillaumeGomez:run_but, r=steveklabnikGuillaume Gomez-1/+2
Set run button transparent instead of invisible r? @steveklabnik And of course a screenshot: ![screenshot from 2016-09-08 01-15-45](https://cloud.githubusercontent.com/assets/3050060/18331849/31fe1f8c-7562-11e6-9ae9-1dab44089ec6.png)
2016-09-14Auto merge of #35667 - ollie27:rustdoc_opaque_structs, r=steveklabnikbors-6/+15
rustdoc: Don't add extra newlines for fully opaque structs Changes the definition for braced structs with only private or hidden fields to save space on the page. Before: ``` pub struct Vec<T> { // some fields omitted } ``` After: ``` pub struct Vec<T> { /* fields omitted */ } ``` This also cleans up empty braced structs. Before: ``` pub struct Foo { } ``` After: ``` pub struct Foo {} ``` [before](https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html) [after](https://ollie27.github.io/rust_doc_test/std/vec/struct.Vec.html) cc #34713
2016-09-13Remove some ancient code providing special support for newtypesVadim Petrochenkov-1/+1
2016-09-10Rollup merge of #36045 - ollie27:rustdoc_titles3, r=steveklabnikGuillaume Gomez-3/+15
rustdoc: Add missing item types to page titles Most pages include the item type in the title such as "Struct std::vec::Vec". However it is missing from the pages for foreign functions, type definitions, macros, statics and constants. This adds them so for example, instead of a title of "std::u32::MAX" it is "Constant std::u32::MAX" to match the others. [before](https://doc.rust-lang.org/nightly/std/u32/constant.MAX.html) [after](https://ollie27.github.io/rust_doc_test/std/u32/constant.MAX.html) [before](https://doc.rust-lang.org/nightly/std/io/type.Result.html) [after](https://ollie27.github.io/rust_doc_test/std/io/type.Result.html) Previous discussions: #34345, #35003
2016-09-09rustdoc: don't collapse `docblock-short`Liigo-1/+1
2016-09-09rustdoc: Don't add extra newlines for fully opaque structsOliver Middleton-6/+15
Changes the definition for opaque structs to look like `pub struct Vec<T> { /* fields omitted */ }` to save space on the page. Also only use one line for empty braced structs.
2016-09-08Set run button transparent instead of invisibleGuillaume Gomez-1/+2
2016-09-07Auto merge of #36266 - Sawyer47:issue-35169, r=alexcrichtonbors-27/+60
rustdoc: Filter more incorrect methods inherited through Deref Old code filtered out only static methods. This code also excludes &mut self methods if there is no DerefMut implementation. Fixes #35169
2016-09-05Auto merge of #36078 - ollie27:rustdoc_search_assocconst, r=alexcrichtonbors-11/+10
rustdoc: Fix associated consts in search results Associated consts can appear in none trait impls so need to be treated like methods when generating the search index. Fixes #36031
2016-09-05rustdoc: Filter more incorrect methods inherited through DerefPiotr Jawniak-27/+60
Old code filtered out only static methods. This code also excludes &mut self methods if there is no DerefMut implementation
2016-09-04Replace `_, _` with `..`Vadim Petrochenkov-1/+1
2016-09-03Fix rebase + address commentsVadim Petrochenkov-4/+2
2016-09-03Support unions in rustdocVadim Petrochenkov-3/+78
2016-08-29Add some features to flock.Michael Woerister-1/+1
2016-08-29Move `flock.rs` from librustdoc to librustc_data_structures.Michael Woerister-1/+2
2016-08-29rustdoc: Fix associated consts in search resultsOliver Middleton-11/+10
Associated consts can appear in none trait impls so need to be treated like methods when generating the search index.